From ab8970f0effaaefe58c34cb91c6e44c6e4ee4bb2 Mon Sep 17 00:00:00 2001
From: Christian Stenger <christian.stenger@theqtcompany.com>
Date: Wed, 20 Jan 2016 09:38:26 +0100
Subject: [PATCH] Fix issue with 'Run*'/'Stop' actions...

...when canceling the 'Save Changes' dialog. The test run was
canceled before the build, so the 'Run*' and 'Stop' actions stayed
in a wrong state forever.

Change-Id: I535c50a25c149da32123f832dc6575d1c0fe9643
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
---
 plugins/autotest/testrunner.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp
index 50fbb053081..25ea23f6033 100644
--- a/plugins/autotest/testrunner.cpp
+++ b/plugins/autotest/testrunner.cpp
@@ -217,6 +217,13 @@ static void performTestRun(QFutureInterface<TestResult *> &futureInterface,
 
 void TestRunner::prepareToRunTests()
 {
+    ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings =
+        ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings();
+    if (projectExplorerSettings.buildBeforeDeploy && !projectExplorerSettings.saveBeforeBuild) {
+        if (!ProjectExplorer::ProjectExplorerPlugin::saveModifiedFiles())
+            return;
+    }
+
     const bool omitRunConfigWarnings = AutotestPlugin::instance()->settings()->omitRunConfigWarn;
 
     m_executingTests = true;
@@ -250,8 +257,6 @@ void TestRunner::prepareToRunTests()
         return;
     }
 
-    ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings =
-        ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings();
     if (!projectExplorerSettings.buildBeforeDeploy) {
         runTests();
     } else {
-- 
GitLab