From ea29a8309576314ba81c00a80b584674ddb418e6 Mon Sep 17 00:00:00 2001
From: hjk <hjk@theqtcompany.com>
Date: Wed, 9 Mar 2016 11:02:39 +0100
Subject: [PATCH] Debugger: Do not switch to undefined perspectives

This implies switching to Debug mode and is currently triggered
by the GammrayIntegration. Avoid it as long as GammaRay has
a mode of its own.

Change-Id: I6174554610038cb66fb1bc977dc537b47941a1d8
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
---
 src/plugins/debugger/debuggerplugin.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index e8dbfef5073..8ffac852075 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -959,7 +959,6 @@ public:
         const QString &stopButtonText, const QString &cancelButtonText) const;
 
     void registerAction(Core::Id actionId, const ActionDescription &desc, QAction *startAction);
-    void selectPerspective(const QByteArray &perspectiveId);
 
     // Called when all dependent plugins have loaded.
     void initialize();
@@ -3421,11 +3420,6 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
     }
 }
 
-void DebuggerPluginPrivate::selectPerspective(const QByteArray &perspectiveId)
-{
-    m_mainWindow->restorePerspective(perspectiveId);
-}
-
 void DebuggerPluginPrivate::registerAction(Id actionId, const ActionDescription &desc, QAction *startAction)
 {
     auto action = new QAction(this);
@@ -3616,8 +3610,11 @@ void registerPerspective(const QByteArray &perspectiveId, const Perspective &per
 
 void selectPerspective(const QByteArray &perspectiveId)
 {
+    // FIXME: Work-around aslong as the GammaRay integration does not use the same setup,
+    if (perspectiveId.isEmpty())
+        return;
     ModeManager::activateMode(MODE_DEBUG);
-    dd->selectPerspective(perspectiveId);
+    dd->m_mainWindow->restorePerspective(perspectiveId);
 }
 
 void runAction(Id actionId)
-- 
GitLab