From 1f415fb39eb3777ff71e0b2d0717e743a7d750a2 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 9 May 2012 19:38:07 +0400 Subject: [PATCH] timerd/timermanager.cpp: fix using invalidated after erase iterator --- src/timerd/timermanager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index dfbb5384d..d02c93644 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -212,8 +212,10 @@ void* CTimerManager::timerThread(void *arg) pos->second->printEvent(); dprintf("\n"); delete pos->second; // delete event - timerManager->events.erase(pos); // remove from list + timerManager->events.erase(pos++); // remove from list timerManager->m_saveEvents = true; + if(pos == timerManager->events.end()) + break; } } pthread_mutex_unlock(&tm_eventsMutex);