From 6ba95df13deb2e40123b4c3137a4927ac17e3e5e Mon Sep 17 00:00:00 2001 From: Micah Stanley Date: Thu, 13 Nov 2025 15:49:23 +0000 Subject: [PATCH] shelldbusclient: check if reply is valid --- .../mobileshellstate/shelldbusclient.cpp | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/components/mobileshellstate/shelldbusclient.cpp b/components/mobileshellstate/shelldbusclient.cpp index 28a94ab1..8884666f 100644 --- a/components/mobileshellstate/shelldbusclient.cpp +++ b/components/mobileshellstate/shelldbusclient.cpp @@ -169,6 +169,12 @@ void ShellDBusClient::updatePanelState() QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) { QDBusPendingReply reply = *watcher; + if (!reply.isValid()) { + qDebug() << "ShellDBusClient: Failed to fetch updatePanelState:" << reply.error().message(); + watcher->deleteLater(); + return; + } + QString panelState = reply.argumentAt<0>(); if (panelState != m_panelState) { @@ -187,6 +193,12 @@ void ShellDBusClient::updateDoNotDisturb() QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) { QDBusPendingReply reply = *watcher; + if (!reply.isValid()) { + qDebug() << "ShellDBusClient: Failed to fetch updateDoNotDisturb:" << reply.error().message(); + watcher->deleteLater(); + return; + } + bool doNotDisturb = reply.argumentAt<0>(); if (doNotDisturb != m_doNotDisturb) { @@ -205,6 +217,12 @@ void ShellDBusClient::updateIsActionDrawerOpen() QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) { QDBusPendingReply reply = *watcher; + if (!reply.isValid()) { + qDebug() << "ShellDBusClient: Failed to fetch updateIsActionDrawerOpen:" << reply.error().message(); + watcher->deleteLater(); + return; + } + bool isActionDrawerOpen = reply.argumentAt<0>(); if (isActionDrawerOpen != m_isActionDrawerOpen) { @@ -223,6 +241,12 @@ void ShellDBusClient::updateIsVolumeOSDOpen() QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) { QDBusPendingReply reply = *watcher; + if (!reply.isValid()) { + qDebug() << "ShellDBusClient: Failed to fetch updateIsVolumeOSDOpen:" << reply.error().message(); + watcher->deleteLater(); + return; + } + bool isVolumeOSDOpen = reply.argumentAt<0>(); if (isVolumeOSDOpen != m_isVolumeOSDOpen) { @@ -241,7 +265,13 @@ void ShellDBusClient::updateIsNotificationPopupDrawerOpen() QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) { QDBusPendingReply reply = *watcher; - bool isNotificationPopupDrawerOpen = reply.argumentAt<0>(); + if (!reply.isValid()) { + qDebug() << "ShellDBusClient: Failed to fetch updateIsNotificationPopupDrawerOpen:" << reply.error().message(); + watcher->deleteLater(); + return; + } + + bool isNotificationPopupDrawerOpen = reply.argumentAt<0>(); if (isNotificationPopupDrawerOpen != m_isNotificationPopupDrawerOpen) { m_isNotificationPopupDrawerOpen = isNotificationPopupDrawerOpen; @@ -259,6 +289,12 @@ void ShellDBusClient::updateIsTaskSwitcherVisible() QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) { QDBusPendingReply reply = *watcher; + if (!reply.isValid()) { + qDebug() << "ShellDBusClient: Failed to fetch updateIsTaskSwitcherVisible:" << reply.error().message(); + watcher->deleteLater(); + return; + } + bool isTaskSwitcherVisible = reply.argumentAt<0>(); if (isTaskSwitcherVisible != m_isTaskSwitcherVisible) {