delete not valid provider instances (fix memory leaks),

avoid failure due to assertion calling disconnectDb on PG provider more times
This commit is contained in:
Giuseppe Sucameli 2012-06-09 16:24:19 +01:00
parent 32920557b7
commit cbf405f568
2 changed files with 5 additions and 1 deletions

View File

@ -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;

View File

@ -221,11 +221,13 @@ void QgsPostgresProvider::disconnectDb()
if ( mConnectionRO )
{
mConnectionRO->disconnect();
mConnectionRO = 0;
}
if ( mConnectionRW )
{
mConnectionRW->disconnect();
mConnectionRW = 0;
}
}
@ -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;