anymore, fixing a space leak. Not perfect for menus yet...
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@663
7f0cb862-5218-0410-a997-
914c9d46530a
(284) Handle modifiers in MotionNotify events, too. This fixes bug
#1227920 (glutGetModifiers not set/allowed in mouse callbacks). In
addition, some related cleanup has been done.
+
+(285) X11 only: Free XVisualInfo structures when they are not needed
+anymore, fixing a space leak. Not perfect for menus yet...
/* I do not know yet if there will be a fgChooseVisual() function for Win32 */
case GLUT_DISPLAY_MODE_POSSIBLE:
- return( fgChooseVisual() == NULL ? 0 : 1 );
+ {
+ XVisualInfo* visualInfo = fgChooseVisual();
+ if ( visualInfo == NULL ) {
+ return 0;
+ } else {
+ XFree( visualInfo );
+ return 1;
+ }
+ }
/* This is system-dependant */
case GLUT_WINDOW_FORMAT_ID:
#if TARGET_HOST_UNIX_X11
glXDestroyContext( fgDisplay.Display, window->Window.Context );
+ XFree( window->Window.VisualInfo );
XDestroyWindow( fgDisplay.Display, window->Window.Handle );
XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */