Skip to content
Permalink
Browse files
unload plugins on quit (fixes #808)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9249 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 2, 2008
1 parent 87a9325 commit 97808fb5ec2cd394ee16526306a484c767454acd
Showing with 14 additions and 1 deletion.
  1. +2 −0 src/app/qgisapp.cpp
  2. +10 −0 src/app/qgspluginregistry.cpp
  3. +2 −1 src/app/qgspluginregistry.h
@@ -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
@@ -19,6 +19,7 @@

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

QgsPluginRegistry *QgsPluginRegistry::_instance = 0;
QgsPluginRegistry *QgsPluginRegistry::instance()
@@ -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();
}
@@ -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();
@@ -55,4 +57,3 @@ class QgsPluginRegistry
std::map<QString, QgsPluginMetadata*> plugins;
};
#endif //QgsPluginRegistry_H

0 comments on commit 97808fb

Please sign in to comment.