From 85fb0e7c43d893ce8352cb39f8a047037c64d4d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9ven=20Car?= Date: Mon, 4 Oct 2021 10:14:20 +0200 Subject: [PATCH] IdleTimePoller: Fix a crash at shutdown Currently, kwin crashes at shutdown because the idle poller plugin is unloaded when exit handlers are run, after the waylandServer() is destroyed. This results in null dereferencing. BUG: 443268 --- src/plugins/idletime/poller.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/idletime/poller.cpp b/src/plugins/idletime/poller.cpp index 6613ad75d9..3ac43e1860 100644 --- a/src/plugins/idletime/poller.cpp +++ b/src/plugins/idletime/poller.cpp @@ -39,7 +39,9 @@ bool KWinIdleTimePoller::setUpPoller() void KWinIdleTimePoller::unloadPoller() { - disconnect(waylandServer()->idle(), &KWaylandServer::IdleInterface::inhibitedChanged, this, &KWinIdleTimePoller::onInhibitedChanged); + if (waylandServer() && waylandServer()->idle()) { + disconnect(waylandServer()->idle(), &KWaylandServer::IdleInterface::inhibitedChanged, this, &KWinIdleTimePoller::onInhibitedChanged); + } qDeleteAll(m_timeouts); m_timeouts.clear();