From 6a4deb73a97dd3f6364f7150558568155af8c011 Mon Sep 17 00:00:00 2001 From: w00t Date: Thu, 14 Feb 2008 08:21:32 +0000 Subject: Fix timer crashes: relying on an iterator after adding to/resorting the vector probably isn't bright git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8929 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/timer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/timer.cpp') diff --git a/src/timer.cpp b/src/timer.cpp index ca7534a7c..535ed3f8b 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -26,6 +26,9 @@ void TimerManager::TickTimers(time_t TIME) { std::vector::iterator i = Timers.begin(); Timer *t = (*i); + + // Probable fix: move vector manipulation to *before* we modify the vector. + Timers.erase(i); t->Tick(TIME); if (t->GetRepeat()) @@ -35,8 +38,6 @@ void TimerManager::TickTimers(time_t TIME) } else delete t; - - Timers.erase(i); } } -- cgit v1.2.3