Menus should deallocate better now - John Fay

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@178 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
puggles 2003-09-08 20:36:23 +00:00
parent 43736604fb
commit 18bf7821a6
2 changed files with 6 additions and 1 deletions

View File

@ -793,12 +793,13 @@ void FGAPIENTRY glutMainLoopEvent( void )
/* Save the current window and menu and set the current window to the window whose menu this is */
SFG_Window *save_window = fgStructure.Window ;
SFG_Menu *save_menu = fgStructure.Menu ;
SFG_Window *parent_window = window->ActiveMenu->ParentWindow ;
fgSetWindow ( window ) ;
fgStructure.Menu = window->ActiveMenu ;
/* Execute the menu callback */
fgExecuteMenuCallback ( window->ActiveMenu ) ;
fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
fgDeactivateMenu ( parent_window ) ;
/* Restore the current window and menu */
fgSetWindow ( save_window ) ;

View File

@ -321,6 +321,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
* have everything inside it freed and we do not have to care...
*/
free( window );
if ( fgStructure.Window == window ) fgStructure.Window = NULL ;
}
/*
@ -432,6 +433,9 @@ void fgDestroyMenu( SFG_Menu* menu )
/*
* Destroy the window associated with the menu
*/
if ( fgStructure.Window == menu->Window )
fgSetWindow ( menu->ParentWindow ) ;
fgDestroyWindow ( menu->Window, TRUE ) ;
/*