Skip to content

Commit

Permalink
delete not valid provider instances (fix memory leaks),
Browse files Browse the repository at this point in the history
avoid failure due to assertion calling disconnectDb on PG provider more times
  • Loading branch information
brushtyler committed Jun 9, 2012
1 parent 3292055 commit cbf405f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/core/qgsproviderregistry.cpp
Expand Up @@ -400,6 +400,8 @@ QgsDataProvider *QgsProviderRegistry::provider( QString const & providerKey, QSt
// necessarily a reflection on the data provider itself
QgsDebugMsg( "Invalid data provider" );

delete dataProvider;

myLib->unload();
delete myLib;
return 0;
Expand Down
4 changes: 3 additions & 1 deletion src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -221,11 +221,13 @@ void QgsPostgresProvider::disconnectDb()
if ( mConnectionRO )
{
mConnectionRO->disconnect();
mConnectionRO = 0;
}

if ( mConnectionRW )
{
mConnectionRW->disconnect();
mConnectionRW = 0;
}
}

Expand Down Expand Up @@ -2870,7 +2872,7 @@ bool QgsPostgresProvider::getGeometryDetails()
mEnabledCapabilities &= ~( QgsVectorDataProvider::ChangeGeometries | QgsVectorDataProvider::AddFeatures );
}

QgsDebugMsg( QString( "Feature type name is %1" ).arg( QGis::qgisFeatureTypes[ geometryType()] ) );
QgsDebugMsg( QString( "Feature type name is %1" ).arg( QGis::qgisFeatureTypes[ geometryType() ] ) );
QgsDebugMsg( QString( "Geometry is geography %1" ).arg( mIsGeography ) );

return mValid;
Expand Down

0 comments on commit cbf405f

Please sign in to comment.