Fixing a 'gamemode at_exit' bug courtesy of Diederick Niehorster per e-mail dated...
[freeglut] / src / freeglut_window.c
index 41c3fe7..7d50a9d 100644 (file)
@@ -1332,10 +1332,11 @@ void fgOpenWindow( SFG_Window* window, const char* title,
  */
 void fgCloseWindow( SFG_Window* window )
 {
-    /* if we're in gamemode, call glutLeaveGameMode first to make sure the
-     * gamemode is properly closed before closing the window
+    /* if we're in gamemode and we're closing the gamemode window,
+     * call glutLeaveGameMode first to make sure the gamemode is
+     * properly closed before closing the window
      */
-    if (fgStructure.GameModeWindow != NULL)
+    if (fgStructure.GameModeWindow != NULL && fgStructure.GameModeWindow->ID==window->ID)
         glutLeaveGameMode();
 
 #if TARGET_HOST_POSIX_X11