fgDeactivateMenu could sometimes be called twice on the same menu, avoid
crash in that situation git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1524 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
5fe69bdac1
commit
371adb260e
@ -679,6 +679,7 @@ GLboolean fgCheckActiveMenu ( SFG_Window *window, int button, GLboolean pressed,
|
|||||||
/*
|
/*
|
||||||
* Deactivates a menu pointed by the function argument.
|
* Deactivates a menu pointed by the function argument.
|
||||||
*/
|
*/
|
||||||
|
static SFG_Menu* menuDeactivating = NULL;
|
||||||
void fgDeactivateMenu( SFG_Window *window )
|
void fgDeactivateMenu( SFG_Window *window )
|
||||||
{
|
{
|
||||||
SFG_Window *parent_window = NULL;
|
SFG_Window *parent_window = NULL;
|
||||||
@ -690,6 +691,10 @@ void fgDeactivateMenu( SFG_Window *window )
|
|||||||
/* Check if there is an active menu attached to this window... */
|
/* Check if there is an active menu attached to this window... */
|
||||||
menu = window->ActiveMenu;
|
menu = window->ActiveMenu;
|
||||||
freeglut_return_if_fail( menu );
|
freeglut_return_if_fail( menu );
|
||||||
|
/* Check if we are already deactivating this menu, abort in that case (glutHideWindow below can cause this function to be called again on the same menu..) */
|
||||||
|
if (menu==menuDeactivating)
|
||||||
|
return;
|
||||||
|
menuDeactivating = menu;
|
||||||
|
|
||||||
parent_window = menu->ParentWindow;
|
parent_window = menu->ParentWindow;
|
||||||
|
|
||||||
@ -717,6 +722,8 @@ void fgDeactivateMenu( SFG_Window *window )
|
|||||||
if( menuEntry->SubMenu )
|
if( menuEntry->SubMenu )
|
||||||
fghDeactivateSubMenu( menuEntry );
|
fghDeactivateSubMenu( menuEntry );
|
||||||
}
|
}
|
||||||
|
/* Done deactivating menu */
|
||||||
|
menuDeactivating = NULL;
|
||||||
|
|
||||||
fgSetWindow ( parent_window ) ;
|
fgSetWindow ( parent_window ) ;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user