X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=freeglut-1.3%2Ffreeglut_structure.c;h=6b54d50466682b830adff601e6e4a4cd5d7ae8d9;hb=a351855ee6b2ec6f477635a367c745d733219c3e;hp=335168aad1ecd27a2a928de2de9a24bc83adbf84;hpb=583baa8756a71ed088b8e46c52a945218037314c;p=freeglut diff --git a/freeglut-1.3/freeglut_structure.c b/freeglut-1.3/freeglut_structure.c index 335168a..6b54d50 100644 --- a/freeglut-1.3/freeglut_structure.c +++ b/freeglut-1.3/freeglut_structure.c @@ -252,9 +252,15 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) /* * If the programmer defined a destroy callback, call it + * A. Donev: But first make this the active window */ if ( window->Callbacks.Destroy != NULL ) + { + SFG_Window *activeWindow = fgStructure.Window ; + fgStructure.Window = window ; window->Callbacks.Destroy () ; + fgStructure.Window = activeWindow ; + } /* * Now we should remove the reference to this window from its parent @@ -354,6 +360,18 @@ void fgDestroyMenu( SFG_Menu* menu ) } /* + * If the programmer defined a destroy callback, call it + * A. Donev: But first make this the active menu + */ + if ( menu->Destroy != NULL ) + { + SFG_Menu *activeMenu=fgStructure.Menu; + fgStructure.Menu = menu; + menu->Destroy () ; + fgStructure.Menu = activeMenu; + } + + /* * Now we are pretty sure the menu is not used anywhere * and that we can remove all of its entries */