Fixed part of bug #926883 (Video mode matching code, memory leaks,

fullscreen), i.e. memory leak caused by not freeing the mode lines
returned by XF86VidModeGetAllModeLines


git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@557 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
spanne 2005-01-03 14:14:56 +00:00
parent 2e4ddfd047
commit f7ef083831
2 changed files with 19 additions and 15 deletions

View File

@ -891,3 +891,7 @@ default.
(232) Improved error message a bit when no suitable visual could be found
(X11 only).
(233) Fixed part of bug #926883 (Video mode matching code, memory leaks,
fullscreen), i.e. memory leak caused by not freeing the mode lines returned
by XF86VidModeGetAllModeLines

View File

@ -180,9 +180,10 @@ static void fghRestoreState( void )
*/
XFlush( fgDisplay.Display );
return;
break;
}
}
XFree( displayModes );
}
# else
@ -217,6 +218,7 @@ static GLboolean fghCheckDisplayMode( int width, int height, int depth, int refr
*/
static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
{
GLboolean success = GL_FALSE;
#if TARGET_HOST_UNIX_X11
/*
@ -249,22 +251,21 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
fgState.GameModeDepth,
fgState.GameModeRefresh ) )
{
if( haveToTest )
return GL_TRUE;
/* OKi, this is the display mode we have been looking for... */
if( !haveToTest ) {
XF86VidModeSwitchToMode(
fgDisplay.Display,
fgDisplay.Screen,
displayModes[ i ]
);
return GL_TRUE;
}
success = GL_TRUE;
break;
}
}
XFree( displayModes );
}
/* Something must have gone wrong */
return GL_FALSE;
# else
/*
* XXX warning fghChangeDisplayMode: missing XFree86 video mode extensions,
@ -275,7 +276,6 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
#elif TARGET_HOST_WIN32 || TARGET_HOST_WINCE
unsigned int displayModes = 0, mode = 0xffffffff;
GLboolean success = GL_FALSE;
/* HDC desktopDC; */
DEVMODE devMode;
@ -341,9 +341,9 @@ static GLboolean fghChangeDisplayMode( GLboolean haveToTest )
}
}
return success;
#endif
return success;
}