Skip to content

Commit 97808fb

Browse files
author
jef
committed
unload plugins on quit (fixes #808)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9249 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 87a9325 commit 97808fb

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

src/app/qgisapp.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,8 @@ void QgisApp::saveRecentProjectPath( QString projectPath, QSettings & settings )
17401740

17411741
void QgisApp::saveWindowState()
17421742
{
1743+
QgsPluginRegistry::instance()->unloadAll();
1744+
17431745
// store window and toolbar positions
17441746
QSettings settings;
17451747
// store the toolbar/dock widget settings using Qt4 settings API

src/app/qgspluginregistry.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "qgspluginregistry.h"
2121
#include "qgspluginmetadata.h"
22+
#include "qgisplugin.h"
2223

2324
QgsPluginRegistry *QgsPluginRegistry::_instance = 0;
2425
QgsPluginRegistry *QgsPluginRegistry::instance()
@@ -85,3 +86,12 @@ void QgsPluginRegistry::removePlugin( QString name )
8586
{
8687
plugins.erase( name );
8788
}
89+
90+
void QgsPluginRegistry::unloadAll()
91+
{
92+
for(std::map<QString, QgsPluginMetadata*>::iterator it=plugins.begin();
93+
it!=plugins.end();
94+
it++)
95+
if( it->second->plugin() )
96+
it->second->plugin()->unload();
97+
}

src/app/qgspluginregistry.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class QgsPluginRegistry
4747
void addPythonPlugin( QString packageName, QString pluginName );
4848
//! Remove a plugin from the list of loaded plugins
4949
void removePlugin( QString name );
50+
//! Unload plugins
51+
void unloadAll();
5052
protected:
5153
//! protected constructor
5254
QgsPluginRegistry();
@@ -55,4 +57,3 @@ class QgsPluginRegistry
5557
std::map<QString, QgsPluginMetadata*> plugins;
5658
};
5759
#endif //QgsPluginRegistry_H
58-

0 commit comments

Comments
 (0)