Fixing the "fgDeinitialize" call properly per e-mail from John Tsiombikas dated 12...
[freeglut] / src / freeglut_init.c
index 194248a..8c254bc 100644 (file)
@@ -390,7 +390,12 @@ static void fghInitialize( const char* displayName )
 #endif
 
     fgState.Initialised = GL_TRUE;
+
+    /* Avoid registering atexit callback on Win32 as it results in an access
+     * violation due to calling into a module which has been unloaded. */
+#if ( TARGET_HOST_MS_WINDOWS == 0 )
     atexit(fgDeinitialize);
+#endif
 
     /* InputDevice uses GlutTimerFunc(), so fgState.Initialised must be TRUE */
     fgInitialiseInputDevices();