From 7a98c7d5e58a3afef1f85eafa92aed5ce1f30de9 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Tue, 7 Aug 2018 11:45:19 +0200 Subject: [PATCH] [Notifications Engine] Guard "this" On teardown with the popup expanded, the cleanup handler might fire with us already having been deleted. BUG: 397105 FIXED-IN: 5.12.7 Differential Revision: https://phabricator.kde.org/D14651 --- dataengines/notifications/notificationsengine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dataengines/notifications/notificationsengine.cpp b/dataengines/notifications/notificationsengine.cpp index d7a03562d..0d4f596b0 100644 --- a/dataengines/notifications/notificationsengine.cpp +++ b/dataengines/notifications/notificationsengine.cpp @@ -423,8 +423,11 @@ QSharedPointer NotificationsEngine::createInhibition(cons ni->hint = hint; ni->value = value; - QSharedPointer rc(ni, [this](NotificationInhibiton *ni) { - m_inhibitions.removeOne(ni); + QPointer guard(this); + QSharedPointer rc(ni, [this, guard](NotificationInhibiton *ni) { + if (guard) { + m_inhibitions.removeOne(ni); + } delete ni; }); m_inhibitions.append(ni);