You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kf5-knotifications/0003-catch-unknown-notifica...

48 lines
1.6 KiB

From 1f1ca81dc5f403d7e29219a737a548400b975373 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20L=C3=BCbking?= <thomas.luebking@gmail.com>
Date: Mon, 20 Jul 2015 14:47:11 +0200
Subject: [PATCH 3/8] catch unknown notification entries (nullptr deref)
BUG: 348414
FIXED-IN: 5.13
Signed-off by Martin Klapetek
---
src/notifybyaudio.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/notifybyaudio.cpp b/src/notifybyaudio.cpp
index 98cdfd7..0fafdc7 100644
--- a/src/notifybyaudio.cpp
+++ b/src/notifybyaudio.cpp
@@ -133,18 +133,18 @@ void NotifyByAudio::onAudioFinished()
return;
}
- KNotification *notification = m_notifications.value(m);
+ if (KNotification *notification = m_notifications.value(m, nullptr)) {
+ //if the sound is short enough, we can't guarantee new sounds are
+ //enqueued before finished is emitted.
+ //so to make sure we are looping restart it when the sound finished
+ if (notification->flags() & KNotification::LoopSound) {
+ m->play();
+ return;
+ }
- //if the sound is short enough, we can't guarantee new sounds are
- //enqueued before finished is emitted.
- //so to make sure we are looping restart it when the sound finished
- if (notification->flags() & KNotification::LoopSound) {
- m->play();
- return;
+ finish(notification);
}
- finish(notification);
-
disconnect(m, SIGNAL(currentSourceChanged(Phonon::MediaSource)), this, SLOT(onAudioSourceChanged(Phonon::MediaSource)));
m_notifications.remove(m);
--
1.9.3