[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [knotifications] src: Don't crash if notification doesn't have a widget
From:       David Edmundson <kde () davidedmundson ! co ! uk>
Date:       2015-04-13 11:01:07
Message-ID: E1Yhc71-0006Uh-Nh () scm ! kde ! org
[Download RAW message or body]

Git commit 68ed9d609fc7230740096b35d9f917d062b215dc by David Edmundson.
Committed on 13/04/2015 at 11:00.
Pushed by davidedmundson into branch 'master'.

Don't crash if notification doesn't have a widget

REVIEW: 123329

Notifications don't always have an attached widget, particularly those
launched from Plasma; at which point notifying by task bar doesn't make
sense as there is no window to highlight.

M  +6    -0    src/notifybytaskbar.cpp

http://commits.kde.org/knotifications/68ed9d609fc7230740096b35d9f917d062b215dc

diff --git a/src/notifybytaskbar.cpp b/src/notifybytaskbar.cpp
index 72d01af..bbdf19d 100644
--- a/src/notifybytaskbar.cpp
+++ b/src/notifybytaskbar.cpp
@@ -41,6 +41,12 @@ NotifyByTaskbar::~NotifyByTaskbar()
 void NotifyByTaskbar::notify(KNotification *notification, KNotifyConfig *config)
 {
     Q_UNUSED(config);
+    if (!notification->widget()) {
+        qWarning() << "Could not notify " << notification->eventId() << "by taskbar, \
notification has no associated widget"; +        finish(notification);
+        return;
+    }
+
     qDebug() << notification->id() << \
notification->widget()->topLevelWidget()->winId();  
     WId win = notification->widget()->topLevelWidget()->winId();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic