all repos — openbox @ abd2f914dff6a38b78532e8b269440e6008f8933

openbox fork - make it a bit more like ryudo

fix a mem leak, and make suer the menus arent visible when they are modified
Dana Jansens danakj@orodu.net
commit

abd2f914dff6a38b78532e8b269440e6008f8933

parent

25e1e32f5440f16caae4609185ddcd5d81d8f6eb

1 files changed, 27 insertions(+), 2 deletions(-)

jump to
M openbox/menu.copenbox/menu.c

@@ -161,6 +161,8 @@ xmlFreeDoc(doc);

} 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 @@ }

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 @@ menu_clear_entries(self);

g_free(self->name); g_free(self->title); g_free(self->execute); + + g_free(self); } void menu_free(ObMenu *menu)

@@ -341,7 +355,18 @@ }

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);