Skip to content
Permalink
Browse files

delete not valid provider instances (fix memory leaks),

avoid failure due to assertion calling disconnectDb on PG provider more times
  • Loading branch information
brushtyler committed Jun 9, 2012
1 parent 3292055 commit cbf405f568a1aff855ae9b9c01f5a0614d5637c3
Showing with 5 additions and 1 deletion.
  1. +2 −0 src/core/qgsproviderregistry.cpp
  2. +3 −1 src/providers/postgres/qgspostgresprovider.cpp
@@ -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;
@@ -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;

0 comments on commit cbf405f

Please sign in to comment.
You can’t perform that action at this time.