X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=f59a456cd024d1aa1aa5357f1222d124ee046fe1;hb=f22de63d436e44a5237ba55a7373c9514f23fd45;hp=194248a4ded782932f9fc5aff23e32275535ccd7;hpb=20c326dd70f34697350611e53ad6fe5435b5240f;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 194248a..f59a456 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -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(); @@ -408,6 +413,11 @@ void fgDeinitialize( void ) return; } + /* If we're in game mode, we want to leave game mode */ + if( fgStructure.GameModeWindow ) { + glutLeaveGameMode(); + } + /* If there was a menu created, destroy the rendering context */ if( fgStructure.MenuContext ) {