Skip to content

Commit adf0722

Browse files
3nidsnyalldawson
authored andcommittedDec 15, 2017
address remaining memory leaks
1 parent ab5d895 commit adf0722

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed
 

‎src/core/qgscoordinatetransformcontext.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ void QgsCoordinateTransformContext::readSettings()
283283
d->mDestDatumTransforms.clear();
284284
#endif
285285

286-
QgsSettings *settings = new QgsSettings();
287-
settings->beginGroup( QStringLiteral( "/Projections" ) );
288-
QStringList projectionKeys = settings->allKeys();
286+
QgsSettings settings;
287+
settings.beginGroup( QStringLiteral( "/Projections" ) );
288+
QStringList projectionKeys = settings.allKeys();
289289

290290
//collect src and dest entries that belong together
291291
QMap< QPair< QString, QString >, QPair< int, int > > transforms;
@@ -307,11 +307,11 @@ void QgsCoordinateTransformContext::readSettings()
307307

308308
if ( pkeyIt->contains( QLatin1String( "srcTransform" ) ) )
309309
{
310-
transforms[ qMakePair( srcAuthId, destAuthId )].first = settings->value( *pkeyIt ).toInt();
310+
transforms[ qMakePair( srcAuthId, destAuthId )].first = settings.value( *pkeyIt ).toInt();
311311
}
312312
else if ( pkeyIt->contains( QLatin1String( "destTransform" ) ) )
313313
{
314-
transforms[ qMakePair( srcAuthId, destAuthId )].second = settings->value( *pkeyIt ).toInt();
314+
transforms[ qMakePair( srcAuthId, destAuthId )].second = settings.value( *pkeyIt ).toInt();
315315
}
316316
}
317317
}
@@ -324,20 +324,20 @@ void QgsCoordinateTransformContext::readSettings()
324324
}
325325

326326
d->mLock.unlock();
327-
settings->endGroup();
327+
settings.endGroup();
328328
}
329329

330330
void QgsCoordinateTransformContext::writeSettings()
331331
{
332-
QgsSettings *settings = new QgsSettings();
333-
settings->beginGroup( QStringLiteral( "/Projections" ) );
334-
QStringList groupKeys = settings->allKeys();
332+
QgsSettings settings;
333+
settings.beginGroup( QStringLiteral( "/Projections" ) );
334+
QStringList groupKeys = settings.allKeys();
335335
QStringList::const_iterator groupKeyIt = groupKeys.constBegin();
336336
for ( ; groupKeyIt != groupKeys.constEnd(); ++groupKeyIt )
337337
{
338338
if ( groupKeyIt->contains( QLatin1String( "srcTransform" ) ) || groupKeyIt->contains( QLatin1String( "destTransform" ) ) )
339339
{
340-
settings->remove( *groupKeyIt );
340+
settings.remove( *groupKeyIt );
341341
}
342342
}
343343

@@ -348,9 +348,9 @@ void QgsCoordinateTransformContext::writeSettings()
348348
int sourceDatumTransform = transformIt.value().sourceTransformId;
349349
int destinationDatumTransform = transformIt.value().destinationTransformId;
350350

351-
settings->setValue( srcAuthId + "//" + destAuthId + "_srcTransform", sourceDatumTransform );
352-
settings->setValue( srcAuthId + "//" + destAuthId + "_destTransform", destinationDatumTransform );
351+
settings.setValue( srcAuthId + "//" + destAuthId + "_srcTransform", sourceDatumTransform );
352+
settings.setValue( srcAuthId + "//" + destAuthId + "_destTransform", destinationDatumTransform );
353353
}
354354

355-
settings->endGroup();
355+
settings.endGroup();
356356
}

0 commit comments

Comments
 (0)
Please sign in to comment.