fixed GH #1532: RecordSet and RowFilter: bad use of reference counter

This commit is contained in:
Guenter Obiltschnig
2016-12-30 10:06:06 +01:00
parent 690ba1da2b
commit 642bf58480
4 changed files with 21 additions and 17 deletions

View File

@@ -41,7 +41,6 @@ RecordSet::RecordSet(const Statement& rStatement,
_currentRow(0),
_pBegin(new RowIterator(this, 0 == rowsExtracted())),
_pEnd(new RowIterator(this, true)),
_pFilter(0),
_totalRowCount(UNKNOWN_TOTAL_ROW_COUNT)
{
if (pRowFormatter) setRowFormatter(pRowFormatter);
@@ -55,7 +54,6 @@ RecordSet::RecordSet(Session& rSession,
_currentRow(0),
_pBegin(new RowIterator(this, 0 == rowsExtracted())),
_pEnd(new RowIterator(this, true)),
_pFilter(0),
_totalRowCount(UNKNOWN_TOTAL_ROW_COUNT)
{
if (pRowFormatter) setRowFormatter(pRowFormatter);
@@ -70,7 +68,6 @@ RecordSet::RecordSet(const RecordSet& other):
_pFilter(other._pFilter),
_totalRowCount(other._totalRowCount)
{
if (_pFilter) _pFilter->duplicate();
}
@@ -80,7 +77,6 @@ RecordSet::~RecordSet()
{
delete _pBegin;
delete _pEnd;
if (_pFilter) _pFilter->release();
RowMap::iterator it = _rowMap.begin();
RowMap::iterator end = _rowMap.end();
@@ -377,11 +373,9 @@ std::ostream& RecordSet::copy(std::ostream& os, std::size_t offset, std::size_t
}
void RecordSet::filter(RowFilter* pFilter)
void RecordSet::filter(const Poco::AutoPtr<RowFilter>& pFilter)
{
if (_pFilter) _pFilter->release();
_pFilter = pFilter;
if (_pFilter) _pFilter->duplicate();
}