[plasma/plasma5support/Plasma/6.6] src/dataengines/powermanagement: Fix screen power management inhibition never being re-acquirable

Nate Graham <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 1812089139a10ceb9e35552d9fce4c20142130c6 by Nate Graham.
Committed on 29/07/2026 at 17:34.
Pushed by ngraham into branch 'Plasma/6.6'.

Fix screen power management inhibition never being re-acquirable

stopSuppressingScreenPowerManagement calls org.freedesktop.ScreenSaver.UnInhibit,
which returns void, but declared the reply as QDBusReply<uint>. A void reply
carries no arguments, so Qt's qDBusReplyFill falls through its type check and
sets QDBusError::InvalidSignature, making isValid() always false.

The cookie reset introduced in bea735c5 is conditional on isValid(), so
m_lockInhibitionCookie is never cleared. Since that cookie is inline static and
therefore process-wide, every subsequent beginSuppressingScreenPowerManagement
hits its guard, returns success, and never contacts PowerDevil. Screen power
management can only be inhibited once per process.

Use QDBusReply<void>, matching stopSuppressingSleep in the same function.

BUG: 523605


(cherry picked from commit 5d9f76c0acad446537b849693864e976eaf09a18)

Co-authored-by: Vincent de Robert <[email protected]>

M  +1    -1    src/dataengines/powermanagement/powermanagementjob.cpp

https://invent.kde.org/plasma/plasma5support/-/commit/1812089139a10ceb9e35552d9fce4c20142130c6

diff --git a/src/dataengines/powermanagement/powermanagementjob.cpp b/src/dataengines/powermanagement/powermanagementjob.cpp
index 795b1bd..b4a7dbb 100644
--- a/src/dataengines/powermanagement/powermanagementjob.cpp
+++ b/src/dataengines/powermanagement/powermanagementjob.cpp
@@ -93,7 +93,7 @@ void PowerManagementJob::start()
                                                           QStringLiteral("org.freedesktop.ScreenSaver"),
                                                           QStringLiteral("UnInhibit"));
         msg << m_lockInhibitionCookie;
-        QDBusReply<uint> reply = QDBusConnection::sessionBus().call(msg);
+        QDBusReply<void> reply = QDBusConnection::sessionBus().call(msg);
         m_lockInhibitionCookie = reply.isValid() ? -1 : m_lockInhibitionCookie; // reset cookie if the stop request was successful
         setResult(reply.isValid());
         return;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.