[plasma/plasma5support] src/dataengines/powermanagement: Fix screen power management inhibition never being re-acquirable
Vincent de Robert <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 5d9f76c0acad446537b849693864e976eaf09a18 by Vincent de Robert.
Committed on 29/07/2026 at 07:43.
Pushed by ngraham into branch 'master'.
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
M +1 -1 src/dataengines/powermanagement/powermanagementjob.cpp
https://invent.kde.org/plasma/plasma5support/-/commit/5d9f76c0acad446537b849693864e976eaf09a18
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;