summaryrefslogtreecommitdiff
path: root/src/glut/glx
diff options
context:
space:
mode:
Diffstat (limited to 'src/glut/glx')
-rw-r--r--src/glut/glx/glut_event.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c
index 0a96e8cf71..b5df7b2311 100644
--- a/src/glut/glx/glut_event.c
+++ b/src/glut/glx/glut_event.c
@@ -172,10 +172,14 @@ handleTimeouts(void)
GETTIMEOFDAY(&now);
while (IS_AT_OR_AFTER(__glutTimerList->timeout, now)) {
timer = __glutTimerList;
- __glutTimerList = timer->next;
+ /* call the timer function */
timer->func(timer->value);
+ /* remove from the linked list */
+ __glutTimerList = timer->next;
+ /* put this timer on the "free" list */
timer->next = freeTimerList;
freeTimerList = timer;
+
if (!__glutTimerList)
break;
}