Fix for when the menu's update function returns FALSE and no menu is shown.
authorDana Jansens <danakj@orodu.net>
Mon, 24 Jan 2011 21:45:56 +0000 (16:45 -0500)
committerDana Jansens <danakj@orodu.net>
Sun, 30 Sep 2012 18:50:30 +0000 (14:50 -0400)
The ObMenuFrame was not being freed, and the child pointer was being left
pointing to the frame that was not visible.

openbox/menuframe.c

index 6110045..4887173 100644 (file)
@@ -1046,8 +1046,11 @@ gboolean menu_frame_show_submenu(ObMenuFrame *self, ObMenuFrame *parent,
         parent->child_entry = parent_entry;
     }
 
-    if (!menu_frame_show(self))
+    if (!menu_frame_show(self)) {
+        parent->child = NULL;
+        parent->child_entry = NULL;
         return FALSE;
+    }
 
     menu_frame_place_submenu(self, &x, &y);
     menu_frame_move_on_screen(self, x, y, &dx, &dy);
@@ -1272,7 +1275,8 @@ void menu_entry_frame_show_submenu(ObMenuEntryFrame *self)
     /* pass our direction on to our child */
     f->direction_right = self->frame->direction_right;
 
-    menu_frame_show_submenu(f, self->frame, self);
+    if (!menu_frame_show_submenu(f, self->frame, self))
+        menu_frame_free(f);
 }
 
 void menu_entry_frame_execute(ObMenuEntryFrame *self, guint state)