X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fmenu.c;h=231777f214e589850975e36262480582f96336e3;hb=3a607fad9df628ab16e0f7436dfbfc9b22634003;hp=4a259387009c43bd491fea71fa6162cb1b83d0d6;hpb=aafa246e2f70dac1d42eb60d25777c58b6ebe896;p=chaz%2Fopenbox diff --git a/openbox/menu.c b/openbox/menu.c index 4a259387..231777f2 100644 --- a/openbox/menu.c +++ b/openbox/menu.c @@ -161,6 +161,8 @@ void menu_pipe_execute(ObMenu *self) } else { g_warning("Invalid output from pipe-menu: %s", self->execute); } + + g_free(output); } static ObMenu* menu_from_name(gchar *name) @@ -260,7 +262,17 @@ ObMenu* menu_new(gchar *name, gchar *title, gpointer data) static void menu_destroy_hash_value(ObMenu *self) { - /* XXX make sure its not visible */ + /* make sure its not visible */ + { + GList *it; + ObMenuFrame *f; + + for (it = menu_frame_visible; it; it = g_list_next(it)) { + f = it->data; + if (f->menu == self) + menu_frame_hide_all(); + } + } if (self->destroy_func) self->destroy_func(self, self->data); @@ -269,6 +281,8 @@ static void menu_destroy_hash_value(ObMenu *self) g_free(self->name); g_free(self->title); g_free(self->execute); + + g_free(self); } void menu_free(ObMenu *menu) @@ -283,6 +297,8 @@ void menu_show(gchar *name, gint x, gint y, ObClient *client) if (!(self = menu_from_name(name))) return; + menu_frame_hide_all(); + frame = menu_frame_new(self, client); menu_frame_move(frame, x, y); menu_frame_show(frame, NULL); @@ -339,7 +355,18 @@ void menu_entry_free(ObMenuEntry *self) void menu_clear_entries(ObMenu *self) { - /* XXX assert that the menu isn't visible */ +#ifdef DEBUG + /* assert that the menu isn't visible */ + { + GList *it; + ObMenuFrame *f; + + for (it = menu_frame_visible; it; it = g_list_next(it)) { + f = it->data; + g_assert(f->menu != self); + } + } +#endif while (self->entries) { menu_entry_free(self->entries->data);