forked from qt-creator/qt-creator
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:
@@ -1222,8 +1222,12 @@ void PluginManagerPrivate::loadPlugins()
|
||||
while (it.hasPrevious()) {
|
||||
PluginSpec *spec = it.previous();
|
||||
loadPlugin(spec, PluginSpec::Running);
|
||||
if (spec->state() == PluginSpec::Running)
|
||||
if (spec->state() == PluginSpec::Running) {
|
||||
delayedInitializeQueue.append(spec);
|
||||
} else {
|
||||
// Plugin initialization failed, so cleanup after it
|
||||
spec->d->kill();
|
||||
}
|
||||
}
|
||||
emit q->pluginsChanged();
|
||||
|
||||
@@ -1246,8 +1250,12 @@ void PluginManagerPrivate::shutdown()
|
||||
shutdownEventLoop->exec();
|
||||
}
|
||||
deleteAll();
|
||||
if (!allObjects.isEmpty())
|
||||
qDebug() << "There are" << allObjects.size() << "objects left in the plugin manager pool: " << allObjects;
|
||||
if (!allObjects.isEmpty()) {
|
||||
qDebug() << "There are" << allObjects.size() << "objects left in the plugin manager pool.";
|
||||
// Intentionally split debug info here, since in case the list contains
|
||||
// already deleted object we get at least the info about the number of objects;
|
||||
qDebug() << "The following objects left in the plugin manager pool:" << allObjects;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user