void fgCloseWindows ()
{
SFG_WindowList *window_ptr = WindowsToDestroy ;
- WindowsToDestroy = (SFG_WindowList*)NULL ; // In case the destroy callbacks cause more windows to be closed
+ WindowsToDestroy = (SFG_WindowList*)NULL ; /* In case the destroy callbacks cause more windows to be closed */
while ( window_ptr )
{
/*
* 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
}
/*
+ * 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
*/