Skip to content
Permalink
Browse files

Cleanup methods for providers (implemented for GDAL and OGR)

Fix #8932
  • Loading branch information
m-kuhn committed Dec 5, 2013
1 parent 0bfc766 commit f2fbb2f816899749148f039720ce2b5745f867c8
@@ -199,8 +199,25 @@ QgsProviderRegistry::QgsProviderRegistry( QString pluginPath )
} // QgsProviderRegistry ctor


// typedef for the unload dataprovider function
typedef void cleanupProviderFunction_t();

QgsProviderRegistry::~QgsProviderRegistry()
{
Providers::const_iterator it = mProviders.begin();

while ( it != mProviders.end() )
{
QString lib = it->second->library();
QLibrary myLib( lib );
if ( myLib.isLoaded() )
{
cleanupProviderFunction_t* cleanupFunc = ( cleanupProviderFunction_t* ) cast_to_fptr( myLib.resolve( "cleanupProvider" ) );
if ( cleanupFunc )
cleanupFunc();
}
it++;
}
}


@@ -292,7 +309,6 @@ QDir const & QgsProviderRegistry::libraryDirectory() const
typedef QgsDataProvider * classFactoryFunction_t( const QString * );



/** Copied from QgsVectorLayer::setDataProvider
* TODO: Make it work in the generic environment
*
@@ -2767,3 +2767,8 @@ QGISEXTERN QList<QPair<QString, QString> > *pyramidResamplingMethods()

return &methods;
}

QGISEXTERN void cleanupProvider()
{
GDALDestroyDriverManager();
}
@@ -2456,3 +2456,7 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
);
}

QGISEXTERN void cleanupProvider()
{
OGRCleanupAll();
}

0 comments on commit f2fbb2f

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