Commit 78e9c178 authored by Eike Ziller's avatar Eike Ziller Committed by hjk

Debugger: Avoid switching to debug when the inferior started (or failed)

We already switch to debug mode when starting the run control.
Since loading of projects from the command line is delayed by the
project explorer plugin, and that switches to edit or projects mode, we
must delay the startup of the debugger when started from the command
line until the project explorer plugin really finished all
initialization.

Change-Id: Icfae2b39878084b024c40fa30a2e35f6a0b94a89
Reviewed-by: default avatarhjk <hjk@theqtcompany.com>
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent b93f9af3
......@@ -1199,7 +1199,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
m_arguments = arguments;
if (!m_arguments.isEmpty())
connect(KitManager::instance(), &KitManager::kitsLoaded,
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::finishedInitialization,
this, &DebuggerPluginPrivate::parseCommandLineArguments);
m_mainWindow = new DebuggerMainWindow;
......@@ -2523,7 +2523,6 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
setProxyAction(m_visibleStartAction, Id(Constants::INTERRUPT));
m_hiddenStopAction->setAction(m_interruptAction);
m_localsAndExpressionsWindow->setShowLocals(false);
activateDebugMode();
} else if (state == DebuggerFinished) {
const bool canRun = ProjectExplorerPlugin::canRunStartupProject(ProjectExplorer::Constants::DEBUG_RUN_MODE);
// We don't want to do anything anymore.
......@@ -2548,7 +2547,6 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
m_hiddenStopAction->setAction(m_exitAction);
// show locals in core dumps
m_localsAndExpressionsWindow->setShowLocals(true);
activateDebugMode();
} else {
// Everything else is "undisturbable".
m_interruptAction->setEnabled(false);
......
......@@ -1889,7 +1889,11 @@ void ProjectExplorerPluginPrivate::restoreSession()
connect(dd->m_welcomePage, &ProjectWelcomePage::requestProject,
m_instance, &ProjectExplorerPlugin::openProjectWelcomePage);
dd->m_arguments = arguments;
QTimer::singleShot(0, m_instance, &ProjectExplorerPlugin::restoreSession2);
// delay opening projects from the command line even more
QTimer::singleShot(0, m_instance, []() {
ICore::openFiles(dd->m_arguments, ICore::OpenFilesFlags(ICore::CanContainLineAndColumnNumbers | ICore::SwitchMode));
m_instance->finishedInitialization();
});
updateActions();
}
......@@ -1898,12 +1902,6 @@ void ProjectExplorerPluginPrivate::loadSession(const QString &session)
SessionManager::loadSession(session);
}
void ProjectExplorerPlugin::restoreSession2()
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
ICore::openFiles(dd->m_arguments, ICore::OpenFilesFlags(ICore::CanContainLineAndColumnNumbers | ICore::SwitchMode));
}
void ProjectExplorerPluginPrivate::buildStateChanged(Project * pro)
{
Q_UNUSED(pro)
......
......@@ -161,6 +161,7 @@ public:
static void openOpenProjectDialog();
signals:
void finishedInitialization();
void runControlStarted(ProjectExplorer::RunControl *rc);
void runControlFinished(ProjectExplorer::RunControl *rc);
......@@ -177,7 +178,6 @@ signals:
private:
static bool coreAboutToClose();
static void restoreSession2();
#ifdef WITH_TESTS
private slots:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment