@@ -254,7 +254,9 @@ uint NotificationManager::Notify(const QString &appName, uint replacesId, const
254254
255255 if (entity.processedType () != NotifyEntity::None) {
256256 qint64 id = -1 ;
257+ bool isReplace = false ;
257258 if (entity.isReplace ()) {
259+ isReplace = true ;
258260 auto lastEntity = m_persistence->fetchLastEntity (entity.bubbleId ());
259261 if (lastEntity.isValid ()) {
260262 removePendingEntity (entity);
@@ -284,7 +286,7 @@ uint NotificationManager::Notify(const QString &appName, uint replacesId, const
284286 }
285287 // 0: never expire. -1: DefaultTimeOutMSecs
286288 if (expireTimeout != 0 && !critical) {
287- pushPendingEntity (entity, expireTimeout);
289+ pushPendingEntity (entity, expireTimeout, isReplace );
288290 }
289291 }
290292
@@ -415,8 +417,18 @@ void NotificationManager::emitRecordCountChanged()
415417 emit RecordCountChanged (count);
416418}
417419
418- void NotificationManager::pushPendingEntity (const NotifyEntity &entity, int expireTimeout)
420+ void NotificationManager::pushPendingEntity (const NotifyEntity &entity, int expireTimeout, bool isReplace )
419421{
422+ if (isReplace) {
423+ for (auto iter = m_pendingTimeoutEntities.begin (); iter != m_pendingTimeoutEntities.end ();) {
424+ if (iter.value ().bubbleId () == entity.bubbleId ()) {
425+ m_pendingTimeoutEntities.erase (iter);
426+ break ;
427+ }
428+ ++iter;
429+ }
430+ }
431+
420432 const int interval = expireTimeout == -1 ? DefaultTimeOutMSecs : expireTimeout;
421433
422434 qint64 point = QDateTime::currentMSecsSinceEpoch () + interval;
0 commit comments