fixed qtimer warning and possible crash caused by QScopedPointer deleting QTimer directly instead with deleteLater
This commit is contained in:
parent
cc5739c994
commit
e70a6c8fa8
|
@ -68,6 +68,10 @@ Snore::NotificationData::NotificationData(const Notification &old, const QString
|
||||||
|
|
||||||
NotificationData::~NotificationData()
|
NotificationData::~NotificationData()
|
||||||
{
|
{
|
||||||
|
if(!m_timeoutTimer.isNull())
|
||||||
|
{
|
||||||
|
m_timeoutTimer->deleteLater();
|
||||||
|
}
|
||||||
notificationCount--;
|
notificationCount--;
|
||||||
snoreDebug( SNORE_DEBUG ) << "Deleting Notification: ActiveNotifications" << notificationCount << "id" << m_id << "Close Reason:" << m_closeReason;
|
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())
|
if(m_timeoutTimer.isNull())
|
||||||
{
|
{
|
||||||
m_timeoutTimer.reset(new QTimer());
|
m_timeoutTimer = new QTimer();
|
||||||
m_timeoutTimer->setSingleShot(true);
|
m_timeoutTimer->setSingleShot(true);
|
||||||
m_timeoutTimer->setProperty("notificationID", m_id);
|
m_timeoutTimer->setProperty("notificationID", m_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#include <QSharedData>
|
#include <QSharedData>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QScopedPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
|
|
||||||
namespace Snore{
|
namespace Snore{
|
||||||
|
@ -76,7 +76,7 @@ private:
|
||||||
QHash<int,Action> m_actions;
|
QHash<int,Action> m_actions;
|
||||||
Hint m_hints;
|
Hint m_hints;
|
||||||
Notification m_toReplace;
|
Notification m_toReplace;
|
||||||
QScopedPointer<QTimer> m_timeoutTimer;
|
QPointer<QTimer> m_timeoutTimer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue