X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_structure.c;h=9c515c88fe487cbddda4f4bf70614c8e80d77e23;hb=12965126f5f67bdf811a482b6e4c046f559a0645;hp=d8e09ad439a1e8f48ffc20681249334541aeb582;hpb=4ccf632b1b12b8147cede1c7b94b71633204cc80;p=freeglut diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index d8e09ad..9c515c8 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -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 ) ; /* @@ -486,11 +490,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 ); } /*