From 141f53cfee8471f926cf7f10e0cce18e34e4b718 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Mon, 18 Apr 2011 13:01:12 +0200
Subject: [PATCH] Run/Debug: Do not launch on a library project if user cancels

the executable dialog that pops up.

Reviewed-by: dt
---
 src/plugins/debugger/debuggerrunner.cpp              |  9 +++++++++
 .../projectexplorer/localapplicationruncontrol.cpp   | 12 ++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp
index b0b2b60e04c..782343b7baf 100644
--- a/src/plugins/debugger/debuggerrunner.cpp
+++ b/src/plugins/debugger/debuggerrunner.cpp
@@ -237,6 +237,15 @@ void DebuggerRunControl::setCustomEnvironment(Utils::Environment env)
 void DebuggerRunControl::start()
 {
     QTC_ASSERT(d->m_engine, return);
+    // User canceled input dialog asking for executable when working on library project.
+    if (d->m_engine->startParameters().startMode == StartInternal
+        && d->m_engine->startParameters().executable.isEmpty()) {
+        appendMessage(tr("No executable specified.\n"), ErrorMessageFormat);
+        emit started();
+        emit finished();
+        return;
+    }
+
     debuggerCore()->runControlStarted(d->m_engine);
 
     // We might get a synchronous startFailed() notification on Windows,
diff --git a/src/plugins/projectexplorer/localapplicationruncontrol.cpp b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
index 637070269cf..95010da2e6e 100644
--- a/src/plugins/projectexplorer/localapplicationruncontrol.cpp
+++ b/src/plugins/projectexplorer/localapplicationruncontrol.cpp
@@ -103,11 +103,15 @@ LocalApplicationRunControl::~LocalApplicationRunControl()
 
 void LocalApplicationRunControl::start()
 {
-    m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
     emit started();
-
-    QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
-    appendMessage(msg, NormalMessageFormat);
+    if (m_executable.isEmpty()) {
+        appendMessage(tr("No executable specified.\n"), ErrorMessageFormat);
+        emit finished();
+    }  else {
+        m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
+        QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
+        appendMessage(msg, NormalMessageFormat);
+    }
 }
 
 LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
-- 
GitLab