diff options
author | Vincent Sanders <vince@kyllikki.org> | 2019-10-10 18:04:32 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2019-10-10 18:04:32 +0100 |
commit | 8e986ae214fcf373d9d459b72b643ae62ffa054a (patch) | |
tree | bd7c413bad40f46ab772a20dc5fb254b1a007fa0 /frontends/gtk/scaffolding.c | |
parent | fed47dc35b2d6022e894cc4d387c515b0b391fd6 (diff) | |
download | netsurf-8e986ae214fcf373d9d459b72b643ae62ffa054a.tar.gz netsurf-8e986ae214fcf373d9d459b72b643ae62ffa054a.tar.bz2 |
ensure menu resources are released
this ensures all the menu resources are freed when the containing
window receives the destroy signal. Previously these resources
were leaked.
Diffstat (limited to 'frontends/gtk/scaffolding.c')
-rw-r--r-- | frontends/gtk/scaffolding.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c index e4b4c6fff..001cb91fc 100644 --- a/frontends/gtk/scaffolding.c +++ b/frontends/gtk/scaffolding.c @@ -87,7 +87,7 @@ struct nsgtk_scaffolding { /** link popup menu */ struct nsgtk_link_menu *link_menu; - /** menu entries widgets for sensativity adjustment */ + /** menu entries widgets for sensitivity adjustment */ struct nsgtk_menu menus[PLACEHOLDER_BUTTON]; }; @@ -201,6 +201,14 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data) NSLOG(netsurf, INFO, "scaffold list head: %p", scaf_list); + /* ensure menu resources are freed */ + nsgtk_menu_bar_destroy(gs->menu_bar); + nsgtk_burger_menu_destroy(gs->burger_menu); + nsgtk_popup_menu_destroy(gs->popup_menu); + nsgtk_link_menu_destroy(gs->link_menu); + + free(gs); + if (scaf_list == NULL) { /* no more open windows - stop the browser */ nsgtk_complete = true; @@ -1008,7 +1016,7 @@ create_scaffolding_link_menu(struct nsgtk_scaffolding *g, GtkAccelGroup *group) */ static nserror nsgtk_menu_initialise(struct nsgtk_scaffolding *g) { -#define TOOLBAR_ITEM_p(identifier, name, iconame) \ +#define TOOLBAR_ITEM_p(identifier, name, iconame) \ g->menus[identifier].mhandler = nsgtk_on_##name##_activate_menu; \ g->menus[identifier].iconname = iconame; #define TOOLBAR_ITEM_y(identifier, name, iconame) \ @@ -1393,6 +1401,7 @@ nserror nsgtk_scaffolding_toolbar_context_menu(struct nsgtk_scaffolding *gs) return NSERROR_OK; } + /* exported interface documented in gtk/scaffolding.h */ nserror nsgtk_scaffolding_burger_menu(struct nsgtk_scaffolding *gs) { |