From ca8d4082ecfa2efc3c8f105a8b07b7fc64e34432 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 24 Feb 2023 17:22:53 +0100 Subject: [PATCH] Debugger: Compress consecutive calls to updateLocalsWindow() When expanding all children of a long array, this is called once per item. If we have one update in the end that's enough. Change-Id: Ibb63a9aef752418a1dcafb6190edf5a8005a855f Reviewed-by: David Schulz --- src/plugins/debugger/watchhandler.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 4823a952b90..371f7fe4975 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -469,6 +469,7 @@ public: QSet m_expandedINames; QTimer m_requestUpdateTimer; + QTimer m_localsWindowsTimer; QHash m_reportedTypeInfo; QHash m_reportedTypeFormats; // Type name -> Dumper Formats @@ -515,6 +516,14 @@ WatchModel::WatchModel(WatchHandler *handler, DebuggerEngine *engine) connect(&m_requestUpdateTimer, &QTimer::timeout, this, &WatchModel::updateStarted); + m_localsWindowsTimer.setSingleShot(true); + m_localsWindowsTimer.setInterval(50); + connect(&m_localsWindowsTimer, &QTimer::timeout, this, [this] { + // Force show/hide of return view. + const bool showReturn = m_returnRoot->childCount() != 0; + m_engine->updateLocalsWindow(showReturn); + }); + DebuggerSettings &s = *debuggerSettings(); connect(&s.sortStructMembers, &BaseAspect::changed, m_engine, &DebuggerEngine::updateLocals); @@ -2559,9 +2568,7 @@ void WatchModel::clearWatches() void WatchHandler::updateLocalsWindow() { - // Force show/hide of return view. - bool showReturn = m_model->m_returnRoot->childCount() != 0; - m_engine->updateLocalsWindow(showReturn); + m_model->m_localsWindowsTimer.start(); } QStringList WatchHandler::watchedExpressions()