[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
wilder-5.14
Kai Uwe Broulik 8 years ago
parent cf7381d7fb
commit 7a98c7d5e5
  1. 7
      dataengines/notifications/notificationsengine.cpp

@ -423,8 +423,11 @@ QSharedPointer<NotificationInhibiton> NotificationsEngine::createInhibition(cons
ni->hint = hint;
ni->value = value;
QSharedPointer<NotificationInhibiton> rc(ni, [this](NotificationInhibiton *ni) {
m_inhibitions.removeOne(ni);
QPointer<NotificationsEngine> guard(this);
QSharedPointer<NotificationInhibiton> rc(ni, [this, guard](NotificationInhibiton *ni) {
if (guard) {
m_inhibitions.removeOne(ni);
}
delete ni;
});
m_inhibitions.append(ni);

Loading…
Cancel
Save