Debugger: Have main window handle mode change separately

On shutdown the DebuggerMainWindow might not be alive anymore. By
connecting the signal handler to the window, rather than the plugin we
avoid dereferencing null pointers in that case.

Change-Id: I6421eebc6b1b76f176b31eafeb039d91edd3f0b3
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Ulf Hermann
2016-08-26 13:33:30 +02:00
parent 56a098598f
commit 72cca4855d
3 changed files with 20 additions and 9 deletions

View File

@@ -1770,6 +1770,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &DebuggerPluginPrivate::onModeChanged);
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
m_mainWindow.data(), &DebuggerMainWindow::onModeChanged);
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
this, &DebuggerPluginPrivate::updateDebugWithoutDeployMenu);
@@ -3386,8 +3388,6 @@ void DebuggerPluginPrivate::onModeChanged(Id mode)
editor->widget()->setFocus();
m_toolTipManager.debugModeEntered();
m_mainWindow->setDockActionsVisible(true);
m_mainWindow->restorePerspective({});
// static bool firstTime = true;
// if (firstTime) {
@@ -3405,13 +3405,6 @@ void DebuggerPluginPrivate::onModeChanged(Id mode)
updateActiveLanguages();
} else {
m_toolTipManager.leavingDebugMode();
m_mainWindow->setDockActionsVisible(false);
// Hide dock widgets manually in case they are floating.
foreach (QDockWidget *dockWidget, m_mainWindow->dockWidgets()) {
if (dockWidget->isFloating())
dockWidget->hide();
}
}
}