diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 531b2c09912..72a9be069a6 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -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); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index fec7d9938ce..2c399e9955a 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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) diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index aee6d28f738..64e8882e887 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -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: