Skip to content

Commit cbf405f

Browse files
committed
delete not valid provider instances (fix memory leaks),
avoid failure due to assertion calling disconnectDb on PG provider more times
1 parent 3292055 commit cbf405f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/core/qgsproviderregistry.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
400400
// necessarily a reflection on the data provider itself
401401
QgsDebugMsg( "Invalid data provider" );
402402

403+
delete dataProvider;
404+
403405
myLib->unload();
404406
delete myLib;
405407
return 0;

src/providers/postgres/qgspostgresprovider.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -221,11 +221,13 @@ void QgsPostgresProvider::disconnectDb()
221221
if ( mConnectionRO )
222222
{
223223
mConnectionRO->disconnect();
224+
mConnectionRO = 0;
224225
}
225226

226227
if ( mConnectionRW )
227228
{
228229
mConnectionRW->disconnect();
230+
mConnectionRW = 0;
229231
}
230232
}
231233

@@ -2870,7 +2872,7 @@ bool QgsPostgresProvider::getGeometryDetails()
28702872
mEnabledCapabilities &= ~( QgsVectorDataProvider::ChangeGeometries | QgsVectorDataProvider::AddFeatures );
28712873
}
28722874

2873-
QgsDebugMsg( QString( "Feature type name is %1" ).arg( QGis::qgisFeatureTypes[ geometryType()] ) );
2875+
QgsDebugMsg( QString( "Feature type name is %1" ).arg( QGis::qgisFeatureTypes[ geometryType() ] ) );
28742876
QgsDebugMsg( QString( "Geometry is geography %1" ).arg( mIsGeography ) );
28752877

28762878
return mValid;

0 commit comments

Comments
 (0)