summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-14 08:21:32 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-02-14 08:21:32 +0000
commit6a4deb73a97dd3f6364f7150558568155af8c011 (patch)
treec09ec272a7e13fc1023289adf03deec7a29e3ac3 /src
parentf995b32ff4a570f3c35521e5d426286dd25c1c89 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/timer.cpp5
1 files changed, 3 insertions, 2 deletions
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<Timer *>::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);
}
}