Skip to content

Commit

Permalink
#8725-R: no check 0-pointers to delete
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuarte47 authored and m-kuhn committed Jan 15, 2014
1 parent 61041da commit a7ff8ce
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 30 deletions.
14 changes: 4 additions & 10 deletions src/core/qgsfeatureiterator.cpp
Expand Up @@ -28,11 +28,8 @@ QgsAbstractFeatureIterator::QgsAbstractFeatureIterator( const QgsFeatureRequest&

QgsAbstractFeatureIterator::~QgsAbstractFeatureIterator()
{
if ( mGeometrySimplifier )
{
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;
}
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;
}

bool QgsAbstractFeatureIterator::nextFeature( QgsFeature& f )
Expand Down Expand Up @@ -97,11 +94,8 @@ void QgsAbstractFeatureIterator::deref()

bool QgsAbstractFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod )
{
if ( mGeometrySimplifier )
{
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;
}
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;

// setup the local simplification of geometries to fetch
if ( simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && simplifyMethod.forceLocalOptimization() && !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
Expand Down
14 changes: 4 additions & 10 deletions src/core/qgsvectorlayerfeatureiterator.cpp
Expand Up @@ -103,11 +103,8 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayer* la

QgsVectorLayerFeatureIterator::~QgsVectorLayerFeatureIterator()
{
if ( mEditGeometrySimplifier )
{
delete mEditGeometrySimplifier;
mEditGeometrySimplifier = NULL;
}
delete mEditGeometrySimplifier;
mEditGeometrySimplifier = NULL;

close();
}
Expand Down Expand Up @@ -466,11 +463,8 @@ void QgsVectorLayerFeatureIterator::addJoinedAttributes( QgsFeature &f )

bool QgsVectorLayerFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod )
{
if ( mEditGeometrySimplifier )
{
delete mEditGeometrySimplifier;
mEditGeometrySimplifier = NULL;
}
delete mEditGeometrySimplifier;
mEditGeometrySimplifier = NULL;

// setup the simplification of edited geometries to fetch
if ( simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
Expand Down
15 changes: 5 additions & 10 deletions src/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -89,11 +89,9 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrProvider* p, const QgsFeatur

QgsOgrFeatureIterator::~QgsOgrFeatureIterator()
{
if ( mGeometrySimplifier )
{
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;
}
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;

close();
}

Expand All @@ -109,11 +107,8 @@ bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simp
{
bool providerSimplification = false;

if ( mGeometrySimplifier )
{
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;
}
delete mGeometrySimplifier;
mGeometrySimplifier = NULL;

// setup if required the simplification of OGR-geometries fetched
if ( simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && !simplifyMethod.forceLocalOptimization() && !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) )
Expand Down

0 comments on commit a7ff8ce

Please sign in to comment.