From 2caa653f02fba8bda8df9f86a5f2f40dad9e4a9f Mon Sep 17 00:00:00 2001 From: evgeny Date: Wed, 7 Oct 2026 16:02:10 +0200 Subject: [PATCH] Trace cancellation of pending desktop activity queries --- tools/chatgui/src/user_activity_monitor.cpp | 6 +++++- tools/chatgui/tests/test_message_notification.cpp | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/chatgui/src/user_activity_monitor.cpp b/tools/chatgui/src/user_activity_monitor.cpp index a92b6f02..4ec208b6 100644 --- a/tools/chatgui/src/user_activity_monitor.cpp +++ b/tools/chatgui/src/user_activity_monitor.cpp @@ -118,7 +118,11 @@ void UserActivityMonitor::poll() { connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher, generation, elapsedMs] { QDBusPendingReply reply = *watcher; watcher->deleteLater(); - if (!m_watching || generation != m_generation) return; + if (!m_watching || generation != m_generation) { + GUI_DEBUG("activity: ignored obsolete GNOME reply generation=%llu current=%llu watching=%d", + (unsigned long long)generation, (unsigned long long)m_generation, int(m_watching)); + return; + } m_dbusPending = false; if (reply.isError()) { GUI_WARN("activity: GNOME idle monitor unavailable: %s", qPrintable(reply.error().message())); diff --git a/tools/chatgui/tests/test_message_notification.cpp b/tools/chatgui/tests/test_message_notification.cpp index 3ee637c9..62ced741 100644 --- a/tools/chatgui/tests/test_message_notification.cpp +++ b/tools/chatgui/tests/test_message_notification.cpp @@ -39,6 +39,8 @@ public slots: qulonglong GetIdletime() { ++requests; const qulonglong idle = clock.elapsed() - lastInput; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "notification test: GNOME request=%d idle=%llu delay_ms=%d dbus=%d", + requests, (unsigned long long)idle, delayMs, int(calledFromDBus())); if (delayMs) { const QDBusMessage reply = message().createReply(QVariant::fromValue(idle)); setDelayedReply(true); @@ -160,7 +162,9 @@ private slots: QTest::qWait(20); idle.lastInput = idle.clock.elapsed(); const int before = idle.requests; + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "notification test: waiting for delayed active query after request=%d", before); QTRY_VERIFY_WITH_TIMEOUT(idle.requests > before, 1000); + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "notification test: cancelling old watch activity_count=%d", int(spy.size())); activity.stop(); idle.lastInput = idle.clock.elapsed() - 5000; activity.start();