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