[plasma/libkscreen] src/libdpms: Reset hasPendingChanges in WaylandDpmsHelper Toggle

Vlad Zahorodnii <[email protected]> Tue, 4 Aug 2026 12:04:29 +0000 (UTC)
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 9459943955e2004afd3335126d9958ecf83af9f1 by Vlad Zahorodnii, on behalf of zhang shoucheng.
Committed on 04/08/2026 at 12:00.
Pushed by vladz into branch 'master'.

Reset hasPendingChanges in WaylandDpmsHelper Toggle

M  +4    -1    src/libdpms/waylanddpmshelper.cpp

https://invent.kde.org/plasma/libkscreen/-/commit/9459943955e2004afd3335126d9958ecf83af9f1

diff --git a/src/libdpms/waylanddpmshelper.cpp b/src/libdpms/waylanddpmshelper.cpp
index 976bd638..3594b646 100644
--- a/src/libdpms/waylanddpmshelper.cpp
+++ b/src/libdpms/waylanddpmshelper.cpp
@@ -12,6 +12,7 @@
 #include <QGuiApplication>
 #include <QList>
 #include <QPointer>
+#include <QScopeGuard>
 #include <QScreen>
 #include <QWaylandClientExtensionTemplate>
 #include <qpa/qplatformscreen_p.h>
@@ -149,6 +150,9 @@ void WaylandDpmsHelper::trigger(KScreen::Dpms::Mode mode, const QList<QScreen *>
     }
 
     setHasPendingChanges(true);
+    const auto _ = qScopeGuard([this]() {
+        setHasPendingChanges(false);
+    });
 
     auto level = Dpms::mode_On;
     switch (mode) {
@@ -186,7 +190,6 @@ void WaylandDpmsHelper::trigger(KScreen::Dpms::Mode mode, const QList<QScreen *>
             dpms->set(level);
         }
     }
-    setHasPendingChanges(false);
 }
 
 #include "moc_waylanddpmshelper_p.cpp"