Skip to content
Permalink
Browse files

Safer iterator closing, by always calling ::close() instead of

directly manipulating mClosed

Fixes a crash in the memory data provider (also likely fixes
issues in other providers)
  • Loading branch information
nyalldawson committed Nov 19, 2017
1 parent d6eb8ec commit 6f3ebdee3c9e8574dfc2054e5438002d5cdb6ade
@@ -39,7 +39,7 @@ QgsMemoryFeatureIterator::QgsMemoryFeatureIterator( QgsMemoryFeatureSource *sour
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -32,7 +32,7 @@ QgsCachedFeatureIterator::QgsCachedFeatureIterator( QgsVectorLayerCache *vlCache
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}
if ( !mFilterRect.isNull() )
@@ -118,7 +118,7 @@ QgsCachedFeatureWriterIterator::QgsCachedFeatureWriterIterator( QgsVectorLayerCa
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}
if ( !mFilterRect.isNull() )
@@ -124,7 +124,7 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeat
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}
if ( !mFilterRect.isNull() )
@@ -50,7 +50,7 @@ QgsAfsFeatureIterator::QgsAfsFeatureIterator( QgsAfsFeatureSource *source, bool
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}
}
@@ -45,7 +45,7 @@ QgsDb2FeatureIterator::QgsDb2FeatureIterator( QgsDb2FeatureSource *source, bool
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -50,7 +50,7 @@ QgsDelimitedTextFeatureIterator::QgsDelimitedTextFeatureIterator( QgsDelimitedTe
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -40,7 +40,7 @@ QgsGPXFeatureIterator::QgsGPXFeatureIterator( QgsGPXFeatureSource *source, bool
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -45,7 +45,7 @@ QgsMssqlFeatureIterator::QgsMssqlFeatureIterator( QgsMssqlFeatureSource *source,
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -413,13 +413,7 @@ bool QgsMssqlFeatureIterator::rewind()
if ( !result )
{
QgsDebugMsg( mQuery->lastError().text() );
mQuery.reset();
if ( mDatabase.isOpen() )
mDatabase.close();

iteratorClosed();

mClosed = true;
close();
return false;
}

@@ -88,7 +88,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -54,7 +54,7 @@ QgsVirtualLayerFeatureIterator::QgsVirtualLayerFeatureIterator( QgsVirtualLayerF
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

@@ -824,7 +824,7 @@ QgsWFSFeatureIterator::QgsWFSFeatureIterator( QgsWFSFeatureSource *source,
catch ( QgsCsException & )
{
// can't reproject mFilterRect
mClosed = true;
close();
return;
}

0 comments on commit 6f3ebde

Please sign in to comment.
You can’t perform that action at this time.