Skip to content

Commit

Permalink
unload plugins on quit (fixes #808)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@9249 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 2, 2008
1 parent 4d615c5 commit 299c535
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/qgisapp.cpp
Expand Up @@ -1740,6 +1740,8 @@ void QgisApp::saveRecentProjectPath( QString projectPath, QSettings & settings )

void QgisApp::saveWindowState()
{
QgsPluginRegistry::instance()->unloadAll();

// store window and toolbar positions
QSettings settings;
// store the toolbar/dock widget settings using Qt4 settings API
Expand Down
10 changes: 10 additions & 0 deletions src/app/qgspluginregistry.cpp
Expand Up @@ -19,6 +19,7 @@

#include "qgspluginregistry.h"
#include "qgspluginmetadata.h"
#include "qgisplugin.h"

QgsPluginRegistry *QgsPluginRegistry::_instance = 0;
QgsPluginRegistry *QgsPluginRegistry::instance()
Expand Down Expand Up @@ -85,3 +86,12 @@ void QgsPluginRegistry::removePlugin( QString name )
{
plugins.erase( name );
}

void QgsPluginRegistry::unloadAll()
{
for(std::map<QString, QgsPluginMetadata*>::iterator it=plugins.begin();
it!=plugins.end();
it++)
if( it->second->plugin() )
it->second->plugin()->unload();
}
3 changes: 2 additions & 1 deletion src/app/qgspluginregistry.h
Expand Up @@ -47,6 +47,8 @@ class QgsPluginRegistry
void addPythonPlugin( QString packageName, QString pluginName );
//! Remove a plugin from the list of loaded plugins
void removePlugin( QString name );
//! Unload plugins
void unloadAll();
protected:
//! protected constructor
QgsPluginRegistry();
Expand All @@ -55,4 +57,3 @@ class QgsPluginRegistry
std::map<QString, QgsPluginMetadata*> plugins;
};
#endif //QgsPluginRegistry_H

0 comments on commit 299c535

Please sign in to comment.