commit 92f71adb8bb6e46d4a3187ab8824c859312e9136 Author: Aaron Seigo Date: Tue Feb 1 12:54:44 2011 -0800 try to avoid doing any work when we are deleting diff --git a/plasma/generic/applets/notifications/ui/notificationgroup.cpp b/plasma/generic/applets/notifications/ui/notificationgroup.cpp index 1f7c0b8..6bbf43c 100644 --- a/plasma/generic/applets/notifications/ui/notificationgroup.cpp +++ b/plasma/generic/applets/notifications/ui/notificationgroup.cpp @@ -66,6 +66,8 @@ NotificationGroup::NotificationGroup(Extender *parent, uint groupId) NotificationGroup::~NotificationGroup() { + m_extenderItemsForNotification.clear(); + m_notificationForExtenderItems.clear(); qDeleteAll(m_notifications); } @@ -137,6 +139,11 @@ void NotificationGroup::addNotification(Notification *notification) void NotificationGroup::extenderItemDestroyed(Plasma::ExtenderItem *object) { + if (m_extenderItemsForNotification.isEmpty()) { + // either we aren't tracking this notification or else we're being deleted + return; + } + Notification *n = m_notificationForExtenderItems.value(object); if (n) { @@ -148,10 +155,16 @@ void NotificationGroup::extenderItemDestroyed(Plasma::ExtenderItem *object) void NotificationGroup::removeNotification(Notification *notification) { + if (m_extenderItemsForNotification.isEmpty()) { + // either we aren't tracking this notification or else we're being deleted + return; + } + Plasma::ExtenderItem *item = m_extenderItemsForNotification.value(notification); if (item) { m_notificationForExtenderItems.remove(item); } + m_extenderItemsForNotification.remove(notification); m_notifications.removeAll(notification); QString applicationName = m_appForNotification.value(notification); diff --git a/plasma/generic/applets/notifications/ui/notifications.cpp b/plasma/generic/applets/notifications/ui/notifications.cpp index 9b1a7c0..c7aa6dd 100644 --- a/plasma/generic/applets/notifications/ui/notifications.cpp +++ b/plasma/generic/applets/notifications/ui/notifications.cpp @@ -106,6 +106,9 @@ Notifications::~Notifications() { // stop listening to the manager disconnect(m_manager, 0, this, 0); + if (m_notificationStackDialog) { + disconnect(m_notificationStackDialog, 0, this, 0); + } foreach (Notification *notification, m_manager->notifications()) { // we don't want a destroyed managed after the destruction of manager @@ -342,10 +345,10 @@ void Notifications::initExtenderItem(Plasma::ExtenderItem *extenderItem) return; } - if (extenderItem->config().readEntry("type", "") == "job") { + if (extenderItem->config().readEntry("type", QString()) == "job") { extenderItem->setWidget(new JobWidget(0, extenderItem)); - //unknown type, this should never happen } else { + //unknown type, this should never happen extenderItem->destroy(); } commit 1fc6c46a49695ec6ad6cd80a8459c5c083de8e06 Author: Aaron Seigo Date: Tue Feb 1 12:54:25 2011 -0800 make them all uniqueconnections diff --git a/plasma/generic/applets/notifications/ui/notificationstack.cpp b/plasma/generic/applets/notifications/ui/notificationstack.cpp index 2f68961..3b53559 100644 --- a/plasma/generic/applets/notifications/ui/notificationstack.cpp +++ b/plasma/generic/applets/notifications/ui/notificationstack.cpp @@ -54,11 +54,9 @@ NotificationStack::~NotificationStack() void NotificationStack::addNotification(Notification *notification) { m_canDismissTimer->start(1000); - connect(notification, SIGNAL(notificationDestroyed(Notification *)), this, SLOT(removeNotification(Notification *))); - connect(notification, SIGNAL(expired(Notification *)), this, SLOT(delayedRemoveNotification(Notification *))); - - disconnect(notification, SIGNAL(changed(Notification *)), this, SLOT(notificationChanged(Notification *))); - connect(notification, SIGNAL(changed(Notification *)), this, SLOT(notificationChanged(Notification *))); + connect(notification, SIGNAL(notificationDestroyed(Notification *)), this, SLOT(removeNotification(Notification *)), Qt::UniqueConnection); + connect(notification, SIGNAL(expired(Notification *)), this, SLOT(delayedRemoveNotification(Notification *)), Qt::UniqueConnection); + connect(notification, SIGNAL(changed(Notification *)), this, SLOT(notificationChanged(Notification *)), Qt::UniqueConnection); NotificationWidget *notificationWidget = new NotificationWidget(notification, this); notificationWidget->installEventFilter(this); commit f0f66f023e6f2896bcc2ea67d7922fc0745ff7b5 Author: Aaron Seigo Date: Tue Feb 1 12:54:10 2011 -0800 simplification diff --git a/plasma/generic/applets/notifications/ui/notificationwidget.cpp b/plasma/generic/applets/notifications/ui/notificationwidget.cpp index 7764ede..3f87cfe 100644 --- a/plasma/generic/applets/notifications/ui/notificationwidget.cpp +++ b/plasma/generic/applets/notifications/ui/notificationwidget.cpp @@ -43,7 +43,6 @@ #include #include -#include #include #include #include @@ -170,7 +169,7 @@ NotificationWidget::NotificationWidget(Notification *notification, QGraphicsWidg d->notification = notification; connect(d->signalMapper, SIGNAL(mapped(const QString &)), - d->notification.data(), SLOT(triggerAction(const QString &))); + notification, SLOT(triggerAction(const QString &))); connect(notification, SIGNAL(changed()), this, SLOT(updateNotification())); connect(notification, SIGNAL(destroyed()),