+ {
+ if (window->ActiveMenu->ParentWindow)
+ fgDeactivateMenu( window->ActiveMenu->ParentWindow );
+ else
+ {
+ /*
+ * Its a rare occasion that a window has an ActiveMenu but
+ * that menus does not have a parent window. It happens
+ * however in the corner case bug when one opens a menu in
+ * a main window, then opens a different menu in this main
+ * window's child (you now have two menus open
+ * simultaneously, thats the bug) and then click somewhere
+ * else that causes both menus to close. One of them is
+ * then not properly cleaned up. This finishes the cleaning
+ * and minimizes the impact on the user, he only needs one
+ * extra mouse click.
+ */
+ fghSetMenuParentWindow ( NULL, window->ActiveMenu );
+ window->ActiveMenu->IsActive = GL_FALSE;
+ window->ActiveMenu->ActiveEntry = NULL;
+ window->ActiveMenu = NULL;
+ }
+ }