forked from qt-creator/qt-creator
ActionManager: Work around crash on shutdown
The specific case is that RunControls can be deleted with deleteLater (RunControlPrivate::checkAutoDeleteAndEmitStopped), which posts the deleteLater on the event queue. If that happens "just before" shutdown, the remaining events in the event queue are handled just before the event loop exits, but _after_ aboutToQuit is sent and handled. We ramp down plugins on aboutToQuit though, which means that we first delete all plugins, which deletes ActionManager, and after that stray deleteLater events are handled, ~RunControl > ~DebuggerRunTool > ~DebuggerEngine > ActionManager::unregisterAction. Change-Id: I64f7901a647dc44cc88392312e9548cb46c4c192 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -551,6 +551,7 @@ ActionManager::ActionManager(QObject *parent)
|
||||
ActionManager::~ActionManager()
|
||||
{
|
||||
delete d;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -734,6 +735,8 @@ QList<Command *> ActionManager::commands()
|
||||
*/
|
||||
void ActionManager::unregisterAction(QAction *action, Id id)
|
||||
{
|
||||
if (!d) // stray call during shutdown
|
||||
return;
|
||||
Command *cmd = d->m_idCmdMap.value(id, nullptr);
|
||||
if (!cmd) {
|
||||
qWarning() << "unregisterAction: id" << id.name()
|
||||
|
Reference in New Issue
Block a user