Properly delete plugins dependent on failed plugin

Init all class member pointers to NULL.
This fixes possible crash on exit when dependent
plugin was not loaded (e.g. TextEditor was missing).
In this case plugin's constructor gets called,
initialize() method is _not_ called
and destructor gets called -> crash.

Properly delete dependent plugins on
a plugin which failed to initialize properly.

Fix labels of deleted plugins inside an error dialog
after pressing "Error Details" from "Installed Plugins"
dialog.

Change-Id: Iddc029a0f07dcba2501d734d142fb0e69e9383d3
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Jarek Kobus
2015-06-16 15:24:42 +02:00
parent 8131aea4f9
commit 684267179e
10 changed files with 35 additions and 38 deletions

View File

@@ -93,7 +93,6 @@ CppToolsPlugin::CppToolsPlugin()
CppToolsPlugin::~CppToolsPlugin()
{
m_instance = 0;
delete CppModelManager::instance();
}
CppToolsPlugin *CppToolsPlugin::instance()
@@ -141,6 +140,8 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
Q_UNUSED(arguments)
Q_UNUSED(error)
CppModelManager::instance()->setParent(this);
m_settings = new CppToolsSettings(this); // force registration of cpp tools settings
// Objects