Merge remote branch 'origin/master' into gallium_draw_llvm
[mesa.git] / src / glut / glx / glut_event.c
index 443f9a85740c92ad2e7775aee76999520ead6bb5..4cdb814d76a40d0b075d13e3a5fe85ee9ae89be1 100644 (file)
@@ -24,7 +24,7 @@
 # ifdef __sgi
 #  include <bstring.h>    /* prototype for bzero used by FD_ZERO */
 # endif
-# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
+# if (defined(__FreeBSD__) || defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
 #  include <sys/select.h> /* select system call interface */
 #  ifdef luna
 #   include <sysent.h>
@@ -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;
   }
@@ -660,6 +664,7 @@ processEventsAndTimeouts(void)
          case XK_KP_Delete: /* Introduced in X11R6. */
             /* The Delete character is really an ASCII key. */
             __glutSetWindow(window);
+            assert(keyboard);
             keyboard(127,  /* ASCII Delete character. */
               event.xkey.x, event.xkey.y);
             goto skip;
@@ -1307,6 +1312,7 @@ processWindowWorkList(GLUTwindow * window)
   }
   /* Combine workMask with window->workMask to determine what
      finish and debug work there is. */
+  assert(window);
   workMask |= window->workMask;
 
   if (workMask & GLUT_FINISH_WORK) {
@@ -1339,9 +1345,7 @@ processWindowWorkList(GLUTwindow * window)
   }
 }
 
-#ifndef _WIN32
 static  /* X11 implementations do not need this global. */
-#endif
 void
 __glutProcessWindowWorkLists(void)
 {