From ab967902d82e91af7180f57b4ad82f4be7747a3f Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 27 Oct 2010 14:21:33 +0200
Subject: [PATCH] debugger: prepare removal of plugin()->updateState(this);

---
 src/plugins/debugger/debuggerengine.cpp |  8 +++++++-
 src/plugins/debugger/debuggerengine.h   |  5 ++++-
 src/plugins/debugger/gdb/gdbengine.cpp  | 15 +++++++++------
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 72915e4f6fa..0076792b2b8 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -1487,11 +1487,17 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
         threadsHandler()->notifyRunning();
 
     showMessage(msg, LogDebug);
-    plugin()->updateState(this);
+    updateViews();
 
     emit stateChanged(d->m_state);
 }
 
+void DebuggerEngine::updateViews()
+{
+    // FIXME: This should not be done for slave engines.
+    plugin()->updateState(this);
+}
+
 void DebuggerEngine::setRunInWrapperEngine(bool value)
 {
     d->m_runInWrapperEngine = value;
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index fd7109d5931..d2ced9da7fb 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -152,7 +152,7 @@ public:
     void initializeFromTemplate(DebuggerEngine *other);
 
     virtual void updateWatchData(const Internal::WatchData &data,
-                                 const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
+        const Internal::WatchUpdateFlags & flags = Internal::WatchUpdateFlags());
     void startDebugger(DebuggerRunControl *runControl);
     virtual bool isSessionEngine() const;
 
@@ -286,8 +286,11 @@ public:
     virtual void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
     virtual void quitDebugger(); // called by DebuggerRunControl
 
+    virtual void updateViews();
+
 signals:
     void stateChanged(const DebuggerState &state);
+    void updateViewsRequested();
 
 protected:
     // The base notify*() function implementation should be sufficient
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 5ceaf13f380..9701f9d3206 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -2994,9 +2994,12 @@ void GdbEngine::handleThreadInfo(const GdbResponse &response)
         const int currentThreadId =
             response.data.findChild("current-thread-id").data().toInt();
         threadsHandler()->setCurrentThreadId(currentThreadId);
-        plugin()->updateState(this); // Adjust Threads combobox.
-        if (m_hasInferiorThreadList)
-            postCommand("threadnames " + theDebuggerAction(MaximalStackDepth)->value().toByteArray(), CB(handleThreadNames), id);
+        updateViews(); // Adjust Threads combobox.
+        if (m_hasInferiorThreadList) {
+            postCommand("threadnames " +
+                theDebuggerAction(MaximalStackDepth)->value().toByteArray(),
+                CB(handleThreadNames), id);
+        }
     } else {
         // Fall back for older versions: Try to get at least a list
         // of running threads.
@@ -3034,15 +3037,15 @@ void GdbEngine::handleThreadNames(const GdbResponse &response)
             for (int index = 0, n = threads.size(); index != n; ++index) {
                 ThreadData & thread = threads[index];
                 if (thread.id == (quint64)id) {
-                    thread.name = decodeData(name.findChild("value").data(), name.findChild("valueencoded").data().toInt());
+                    thread.name = decodeData(name.findChild("value").data(),
+                        name.findChild("valueencoded").data().toInt());
                     break;
                 }
             }
         }
         threadsHandler()->setThreads(threads);
-        plugin()->updateState(this);
+        updateViews();
     }
-
 }
 
 
-- 
GitLab