Skip to content

Commit 15ea8e6

Browse files
committed
wayland/lock: add warning on live session lock destruction
1 parent afb2c27 commit 15ea8e6

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎src/wayland/session_lock.cpp‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
#include "../window/proxywindow.hpp"
2323
#include "session_lock/session_lock.hpp"
2424

25+
WlSessionLock::~WlSessionLock() {
26+
if (this->isLocked()) {
27+
qCritical() << "Session lock object was destroyed without unlocking. The session will stay "
28+
"locked in case this was accidental.";
29+
qCritical() << "Component.onDestruction may be used if this behavior is required, but it may "
30+
"result in a lock failing open.";
31+
}
32+
}
33+
2534
void WlSessionLock::onReload(QObject* oldInstance) {
2635
auto* old = qobject_cast<WlSessionLock*>(oldInstance);
2736

‎src/wayland/session_lock.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class WlSessionLock: public Reloadable {
7373

7474
public:
7575
explicit WlSessionLock(QObject* parent = nullptr): Reloadable(parent) {}
76+
~WlSessionLock() override;
7677

7778
void onReload(QObject* oldInstance) override;
7879

0 commit comments

Comments
 (0)