summaryrefslogtreecommitdiff
path: root/src/BaseDisplay.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-05-16 09:24:40 +0000
committerDana Jansens <danakj@orodu.net>2002-05-16 09:24:40 +0000
commitae093dba2fb97124bb4af3eaf4070b46f07dfd74 (patch)
tree4dc63a1f7a5aebe7568e6a95b9d6123cf1539682 /src/BaseDisplay.cc
parenta4c9553c64fb854aa5fdf79f87d5b4d6a07ca67e (diff)
make a new autoRaiseDelay value take effect without having to restart
Diffstat (limited to 'src/BaseDisplay.cc')
-rw-r--r--src/BaseDisplay.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/BaseDisplay.cc b/src/BaseDisplay.cc
index 28742e98..c99b2b16 100644
--- a/src/BaseDisplay.cc
+++ b/src/BaseDisplay.cc
@@ -462,10 +462,10 @@ void BaseDisplay::eventLoop(void) {
gettimeofday(&now, 0);
TimerList::iterator it;
- for (it = timerList.begin(); it != timerList.end(); ) {
+ for (it = timerList.begin(); it != timerList.end(); ++it) {
BTimer *timer = *it;
- ++it; // the timer may be removed from the list, so move ahead now
ASSERT(timer != NULL);
+
tm.tv_sec = timer->getStartTime().tv_sec +
timer->getTimeout().tv_sec;
tm.tv_usec = timer->getStartTime().tv_usec +
@@ -478,12 +478,16 @@ void BaseDisplay::eventLoop(void) {
timer->fireTimeout();
// restart the current timer so that the start time is updated
- if (! timer->doOnce())
+ if (! timer->doOnce()) {
+ // reorder
+ removeTimer(timer);
+ addTimer(timer);
timer->start();
- else {
+ } else
timer->stop();
-// delete timer; // USE THIS?
- }
+ it = timerList.begin(); // we no longer have any idea if the iterator is
+ // valid, but what was at the front() is no
+ // longer.
}
}
}
@@ -531,6 +535,7 @@ void BaseDisplay::addTimer(BTimer *timer) {
void BaseDisplay::removeTimer(BTimer *timer) {
+ ASSERT(timer != (BTimer *) 0);
timerList.remove(timer);
}