diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 6aa2a77aabab44efaed80111fa1469ba20a163d3..a1b4c743fc8b860bcf0e24913e74c00f320b544b 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -2719,11 +2719,6 @@ void DebuggerPlugin::updateState(DebuggerEngine *engine)
     d->updateState(engine);
 }
 
-void DebuggerPlugin::activatePreviousMode()
-{
-    d->activatePreviousMode();
-}
-
 void DebuggerPlugin::activateDebugMode()
 {
     d->activateDebugMode();
@@ -2752,6 +2747,8 @@ void DebuggerPlugin::runControlFinished(DebuggerRunControl *runControl)
     Q_UNUSED(runControl);
     d->m_snapshotHandler->removeSnapshot(runControl);
     d->disconnectEngine();
+    if (d->m_snapshotHandler->size() == 0)
+        d->activatePreviousMode();
 }
 
 DebuggerLanguages DebuggerPlugin::activeLanguages() const
diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h
index b1bbc0e328999ad1b028f724fea4f035f7d7bd4c..80bb7396a94122160d630b7826b42b2ddd0c5c58 100644
--- a/src/plugins/debugger/debuggerplugin.h
+++ b/src/plugins/debugger/debuggerplugin.h
@@ -104,7 +104,6 @@ private:
 
     void resetLocation();
     void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
-    void activatePreviousMode();
     void readSettings();
     void writeSettings() const;