From e70a6c8fa8205fd25cded2b2dc02584fe91f0929 Mon Sep 17 00:00:00 2001 From: Patrick von Reth Date: Sun, 24 Aug 2014 11:14:51 +0200 Subject: [PATCH] fixed qtimer warning and possible crash caused by QScopedPointer deleting QTimer directly instead with deleteLater --- src/core/notification/notification_p.cpp | 6 +++++- src/core/notification/notification_p.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/notification/notification_p.cpp b/src/core/notification/notification_p.cpp index c1d10c4..81a8eab 100644 --- a/src/core/notification/notification_p.cpp +++ b/src/core/notification/notification_p.cpp @@ -68,6 +68,10 @@ Snore::NotificationData::NotificationData(const Notification &old, const QString NotificationData::~NotificationData() { + if(!m_timeoutTimer.isNull()) + { + m_timeoutTimer->deleteLater(); + } notificationCount--; snoreDebug( SNORE_DEBUG ) << "Deleting Notification: ActiveNotifications" << notificationCount << "id" << m_id << "Close Reason:" << m_closeReason; } @@ -102,7 +106,7 @@ QTimer *NotificationData::timeoutTimer() { if(m_timeoutTimer.isNull()) { - m_timeoutTimer.reset(new QTimer()); + m_timeoutTimer = new QTimer(); m_timeoutTimer->setSingleShot(true); m_timeoutTimer->setProperty("notificationID", m_id); } diff --git a/src/core/notification/notification_p.h b/src/core/notification/notification_p.h index 0269599..653a368 100644 --- a/src/core/notification/notification_p.h +++ b/src/core/notification/notification_p.h @@ -27,7 +27,7 @@ #include #include -#include +#include namespace Snore{ @@ -76,7 +76,7 @@ private: QHash m_actions; Hint m_hints; Notification m_toReplace; - QScopedPointer m_timeoutTimer; + QPointer m_timeoutTimer;