projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Leave game mode on "deinitialization" if we entered it, per e-mail from John Tsiombik...
[freeglut]
/
src
/
freeglut_init.c
diff --git
a/src/freeglut_init.c
b/src/freeglut_init.c
index
194248a
..
f59a456
100644
(file)
--- 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;
#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);
atexit(fgDeinitialize);
+#endif
/* InputDevice uses GlutTimerFunc(), so fgState.Initialised must be TRUE */
fgInitialiseInputDevices();
/* InputDevice uses GlutTimerFunc(), so fgState.Initialised must be TRUE */
fgInitialiseInputDevices();
@@
-408,6
+413,11
@@
void fgDeinitialize( void )
return;
}
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 )
{
/* If there was a menu created, destroy the rendering context */
if( fgStructure.MenuContext )
{