Fix timer problem when using Fortran bindings (submitted by Bill Mitchell)
Also, add some comments about what's going on.
diff --git a/src/glut/glx/glut_event.c b/src/glut/glx/glut_event.c
index 0a96e8c..b5df7b2 100644
--- a/src/glut/glx/glut_event.c
+++ b/src/glut/glx/glut_event.c
@@ -172,10 +172,14 @@
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;
}