summaryrefslogtreecommitdiff
path: root/openbox/menu.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-08-14 06:00:38 +0000
committerDana Jansens <danakj@orodu.net>2003-08-14 06:00:38 +0000
commitb0855c19bc358be53282c8f9f842dd29f69bc7b1 (patch)
tree0b7e778e8a27d36b441246eaf6f16948f90f1733 /openbox/menu.c
parent1ac6426abdd36ee8fd441a4312582457f8031072 (diff)
add a menu destructor callback.
fix a possible crasher where a callback was called with a different menu.
Diffstat (limited to 'openbox/menu.c')
-rw-r--r--openbox/menu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/openbox/menu.c b/openbox/menu.c
index b29594d7..0905cb16 100644
--- a/openbox/menu.c
+++ b/openbox/menu.c
@@ -115,6 +115,8 @@ void menu_destroy_hash_value(ObMenu *self)
{
GList *it;
+ if (self->destroy) self->destroy(self);
+
for (it = self->entries; it; it = it->next)
menu_entry_free(it->data);
g_list_free(self->entries);
@@ -215,7 +217,8 @@ ObMenu *menu_new_full(char *label, char *name, ObMenu *parent,
menu_controller_show show, menu_controller_update update,
menu_controller_selected selected,
menu_controller_hide hide,
- menu_controller_mouseover mouseover)
+ menu_controller_mouseover mouseover,
+ menu_controller_destroy destroy)
{
XSetWindowAttributes attrib;
ObMenu *self;
@@ -233,6 +236,7 @@ ObMenu *menu_new_full(char *label, char *name, ObMenu *parent,
self->invalid = TRUE;
/* default controllers */
+ self->destroy = destroy;
self->show = (show != NULL ? show : menu_show_full);
self->hide = (hide != NULL ? hide : menu_hide);
self->update = (update != NULL ? update : menu_render);
@@ -513,7 +517,7 @@ void menu_control_mouseover(ObMenuEntry *self, gboolean enter)
ob_rr_theme->bwidth - ob_rr_theme->menu_overlap;
/* need to get the width. is this bad?*/
- self->parent->update(self->submenu);
+ self->submenu->update(self->submenu);
a = screen_physical_area_monitor(self->parent->xin_area);