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:
parent
43736604fb
commit
18bf7821a6
@ -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 */
|
/* 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_Window *save_window = fgStructure.Window ;
|
||||||
SFG_Menu *save_menu = fgStructure.Menu ;
|
SFG_Menu *save_menu = fgStructure.Menu ;
|
||||||
|
SFG_Window *parent_window = window->ActiveMenu->ParentWindow ;
|
||||||
fgSetWindow ( window ) ;
|
fgSetWindow ( window ) ;
|
||||||
fgStructure.Menu = window->ActiveMenu ;
|
fgStructure.Menu = window->ActiveMenu ;
|
||||||
|
|
||||||
/* Execute the menu callback */
|
/* Execute the menu callback */
|
||||||
fgExecuteMenuCallback ( window->ActiveMenu ) ;
|
fgExecuteMenuCallback ( window->ActiveMenu ) ;
|
||||||
fgDeactivateMenu ( window->ActiveMenu->ParentWindow ) ;
|
fgDeactivateMenu ( parent_window ) ;
|
||||||
|
|
||||||
/* Restore the current window and menu */
|
/* Restore the current window and menu */
|
||||||
fgSetWindow ( save_window ) ;
|
fgSetWindow ( save_window ) ;
|
||||||
|
@ -321,6 +321,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
|
|||||||
* have everything inside it freed and we do not have to care...
|
* have everything inside it freed and we do not have to care...
|
||||||
*/
|
*/
|
||||||
free( window );
|
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
|
* Destroy the window associated with the menu
|
||||||
*/
|
*/
|
||||||
|
if ( fgStructure.Window == menu->Window )
|
||||||
|
fgSetWindow ( menu->ParentWindow ) ;
|
||||||
|
|
||||||
fgDestroyWindow ( menu->Window, TRUE ) ;
|
fgDestroyWindow ( menu->Window, TRUE ) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user