X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=8c254bc888469a993b5a76374efea399fda8f5da;hb=62f61e0957a93d5d6188e146cf5f2aeaf98e6161;hp=57bb0209a40b3561a55aeb7ede92c3f2202b23b9;hpb=6014457a1f427bb0a8a206cfb539b38c7a04ac0a;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index 57bb020..8c254bc 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -211,27 +211,27 @@ static int fghNetWMSupported(void) /* Check if "hint" is present in "property" for "window". */ int fgHintPresent(Window window, Atom property, Atom hint) { - Atom ** atoms_ptr; + Atom *atoms; int number_of_atoms; int supported; int i; supported = 0; - atoms_ptr = malloc(sizeof(Atom *)); number_of_atoms = fghGetWindowProperty(window, property, XA_ATOM, - (unsigned char **) atoms_ptr); + (unsigned char **) &atoms); for (i = 0; i < number_of_atoms; i++) - { - if ((*atoms_ptr)[i] == hint) + { + if (atoms[i] == hint) { supported = 1; break; } - } + } + XFree(atoms); return supported; } @@ -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();