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
This commit is contained in:
Méven Car 2021-10-04 10:14:20 +02:00
parent 8ac93a59ff
commit 85fb0e7c43

View file

@ -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();