Skip to content

Commit

Permalink
Update powerkit.cpp
Browse files Browse the repository at this point in the history
- Avoid potential crash when calling register suspend lock
- Fix broken register suspend lock call on logind

Yes, the project is still alive.
  • Loading branch information
rodlie committed Jan 23, 2024
1 parent 70be27f commit fc2fd48
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/powerkit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,13 @@ bool PowerKit::registerSuspendLock()
if (suspendLock) { return false; }
qDebug() << "register suspend lock";
QDBusReply<QDBusUnixFileDescriptor> reply;
if (HasLogind() && logind->isValid()) {
reply = ckit->call("Inhibit",
"sleep",
"powerkit",
"Lock screen etc",
"delay");
} else if (HasConsoleKit() && ckit->isValid()) {
if (HasLogind() && logind && logind->isValid()) {
reply = logind->call("Inhibit",
"sleep",
"powerkit",
"Lock screen etc",
"delay");
} else if (HasConsoleKit() && ckit && ckit->isValid()) {
reply = ckit->call("Inhibit",
"sleep",
"powerkit",
Expand Down

0 comments on commit fc2fd48

Please sign in to comment.