kutils: start counting from 1 in KPowerManagerInhibitImpl::Inhibit()

because 0 should be invalid cookie, much like the inhibition cookie of the
org.freedesktop.ScreenSaver interface

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-03 16:56:56 +03:00
parent 9195193191
commit 086e08f00a

View file

@ -139,7 +139,7 @@ uint KPowerManagerInhibitImpl::Inhibit(const QString &application, const QString
kWarning() << "Inhibit limit greater than INT_MAX";
return 0;
}
uint cookiecounter = 0;
uint cookiecounter = 1;
while (m_cookies.contains(cookiecounter)) {
if (cookiecounter >= maxinhibitors) {
kWarning() << "Inhibit limit reached";