From 472c8069406c17cb2304794bf300c06b53a846f9 Mon Sep 17 00:00:00 2001
From: con <qtc-committer@nokia.com>
Date: Wed, 9 Sep 2009 18:35:25 +0200
Subject: [PATCH] Move DebuggerRunControl initialization out of ::start method.

---
 src/plugins/debugger/debuggerrunner.cpp | 34 ++++++++++++-------------
 src/plugins/debugger/debuggerrunner.h   |  2 ++
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index 0f9b8b2d80c..75b76845e8b 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -140,39 +140,39 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
             Qt::QueuedConnection);
     connect(this, SIGNAL(stopRequested()),
             m_manager, SLOT(exitDebugger()));
-}
-
-void DebuggerRunControl::start()
-{
-    m_running = true;
-    ApplicationRunConfigurationPtr rc =
-        runConfiguration().objectCast<ApplicationRunConfiguration>();
-    if (rc) {
+    if (runConfiguration) {
         // Enhance parameters by info from the project, but do not clobber
         // arguments given in the dialogs
         if (m_startParameters->executable.isEmpty())
-            m_startParameters->executable = rc->executable();
+            m_startParameters->executable = runConfiguration->executable();
         if (m_startParameters->environment.empty())
-            m_startParameters->environment = rc->environment().toStringList();
+            m_startParameters->environment = runConfiguration->environment().toStringList();
         if (m_startParameters->workingDir.isEmpty())
-            m_startParameters->workingDir = rc->workingDirectory();
+            m_startParameters->workingDir = runConfiguration->workingDirectory();
         if (m_mode != StartExternal)
-            m_startParameters->processArgs = rc->commandLineArguments();
+            m_startParameters->processArgs = runConfiguration->commandLineArguments();
         switch (m_startParameters->toolChainType) {
         case ProjectExplorer::ToolChain::UNKNOWN:
         case ProjectExplorer::ToolChain::INVALID:
-            m_startParameters->toolChainType = rc->toolChainType();
+            m_startParameters->toolChainType = runConfiguration->toolChainType();
             break;
         default:
             break;
         }
-        m_manager->setQtDumperLibraryName(rc->dumperLibrary());
-        m_manager->setQtDumperLibraryLocations(rc->dumperLibraryLocations());
-        if (const ProjectExplorer::Project *project = rc->project()) {
+        if (const ProjectExplorer::Project *project = runConfiguration->project()) {
             m_startParameters->buildDir = project->buildDirectory(project->activeBuildConfiguration());
         }
-        m_startParameters->useTerminal = rc->runMode() == ApplicationRunConfiguration::Console;
+        m_startParameters->useTerminal = runConfiguration->runMode() == ApplicationRunConfiguration::Console;
+        m_dumperLibrary = runConfiguration->dumperLibrary();
+        m_dumperLibraryLocations = runConfiguration->dumperLibraryLocations();
     }
+}
+
+void DebuggerRunControl::start()
+{
+    m_running = true;
+    m_manager->setQtDumperLibraryName(m_dumperLibrary);
+    m_manager->setQtDumperLibraryLocations(m_dumperLibraryLocations);
 
     //emit addToOutputWindow(this, tr("Debugging %1").arg(m_executable));
     m_manager->startNewDebugger(this, m_startParameters);
diff --git a/src/plugins/debugger/debuggerrunner.h b/src/plugins/debugger/debuggerrunner.h
index 0e0b0ac1e77..06a986ce9d3 100644
--- a/src/plugins/debugger/debuggerrunner.h
+++ b/src/plugins/debugger/debuggerrunner.h
@@ -109,6 +109,8 @@ private:
     const QSharedPointer<DebuggerStartParameters> m_startParameters;
     DebuggerManager *m_manager;
     bool m_running;
+    QString m_dumperLibrary;
+    QStringList m_dumperLibraryLocations;
 };
 
 // A default run configuration for external executables or attaching to
-- 
GitLab