X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_structure.c;h=09ad74d9a46d25e80ce566f7631fd2006e31859f;hb=fa43a255b9778016ce78123712b8ff89efd2fb34;hp=454aebfbe3af7114dbb6c9cd45bbb52fc7cd0b5c;hpb=2433cf0a62aea70942f3645c6d4d90bd43d99691;p=freeglut diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index 454aebf..09ad74d 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -273,6 +273,7 @@ void fgCloseWindows () void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) { SFG_Window* subWindow; + int menu_index ; assert( window != NULL ); freeglut_assert_ready; @@ -309,6 +310,15 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) else fgListRemove( &fgStructure.Windows, &window->Node ); + if ( window->ActiveMenu != NULL ) + fgDeactivateMenu ( window ) ; + + for ( menu_index = 0; menu_index < 3; menu_index ++ ) + { + if ( window->Menu[menu_index] != NULL ) + window->Menu[menu_index]->ParentWindow = NULL ; + } + /* * OK, this window seems disconnected from the structure enough * in order to be closed without any bigger risks... @@ -490,11 +500,11 @@ void fgDestroyStructure( void ) /* * Make sure all windows and menus have been deallocated */ - while( (window = (SFG_Window *)fgStructure.Windows.First) != NULL ) - fgDestroyWindow( window, TRUE ); - while( (menu = (SFG_Menu *)fgStructure.Menus.First) != NULL ) fgDestroyMenu( menu ); + + while( (window = (SFG_Window *)fgStructure.Windows.First) != NULL ) + fgDestroyWindow( window, TRUE ); } /*