X11 only: Free XVisualInfo structures when they are not needed

anymore, fixing a space leak. Not perfect for menus yet...


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@663 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
spanne 2005-07-05 12:32:56 +00:00
parent a3d9116d49
commit bd0a87210c
3 changed files with 13 additions and 1 deletions

View File

@ -1096,3 +1096,6 @@ fixes bug #961938 (Executable bit set on non exe files).
(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...

View File

@ -260,7 +260,15 @@ int FGAPIENTRY glutGet( GLenum eWhat )
/* 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:

View File

@ -618,6 +618,7 @@ void fgCloseWindow( SFG_Window* window )
#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 */