Do not try to destroy a GLX context when there is none, e.g. when glXCreateContextAtt...
[freeglut] / src / freeglut_window.c
index 8027e6b..cc73b88 100644 (file)
@@ -1025,7 +1025,8 @@ void fgCloseWindow( SFG_Window* window )
 {
 #if TARGET_HOST_POSIX_X11
 
-    glXDestroyContext( fgDisplay.Display, window->Window.Context );
+    if( window->Window.Context )
+        glXDestroyContext( fgDisplay.Display, window->Window.Context );
     XFree( window->Window.FBConfig );
     XDestroyWindow( fgDisplay.Display, window->Window.Handle );
     /* XFlush( fgDisplay.Display ); */ /* XXX Shouldn't need this */