From efb173390a247a4e626946da55ae91402f176405 Mon Sep 17 00:00:00 2001
From: Christian Kandeler <christian.kandeler@nokia.com>
Date: Tue, 26 Oct 2010 16:29:27 +0200
Subject: [PATCH] Fix Creator crash on SSH connection loss.

QTCREATORBUG-2890

Reviewed-by: dt
---
 .../qt4projectmanager/qt-maemo/maemosshrunner.cpp      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
index 16db4f43869..db29a62e828 100644
--- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
+++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp
@@ -223,9 +223,11 @@ void MaemoSshRunner::handleUnmounted()
         mount();
         break;
     case PostRunCleaning:
-    case StopRequested:
+    case StopRequested: {
         m_mounter->resetMountSpecifications();
-        if (m_state == StopRequested) {
+        const bool stopRequested = m_state == StopRequested;
+        setState(Inactive);
+        if (stopRequested) {
             emit remoteProcessFinished(InvalidExitCode);
         } else if (m_exitStatus == SshRemoteProcess::ExitedNormally) {
             emit remoteProcessFinished(m_runner->exitCode());
@@ -233,8 +235,8 @@ void MaemoSshRunner::handleUnmounted()
             emit error(tr("Error running remote process: %1")
                 .arg(m_runner->errorString()));
         }
-        setState(Inactive);
         break;
+    }
     default: ;
     }
 }
@@ -338,8 +340,8 @@ void MaemoSshRunner::setState(State newState)
 void MaemoSshRunner::emitError(const QString &errorMsg)
 {
     if (m_state != Inactive) {
-        emit error(errorMsg);
         setState(Inactive);
+        emit error(errorMsg);
     }
 }
 
-- 
GitLab