From d2e3102f7d2d96f99c4000b35ca75e394c6fae81 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 14 Jun 2022 17:58:33 +0300 Subject: [PATCH 20/20] gtk3/.22: Unref ui_builder See osdn #44832 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/gui_main.c | 1 + client/gui-gtk-3.0/menu.c | 11 +++++++++++ client/gui-gtk-3.0/menu.h | 1 + client/gui-gtk-3.22/gui_main.c | 1 + client/gui-gtk-3.22/menu.c | 11 +++++++++++ client/gui-gtk-3.22/menu.h | 1 + 6 files changed, 26 insertions(+) diff --git a/client/gui-gtk-3.0/gui_main.c b/client/gui-gtk-3.0/gui_main.c index a5f9605a9c..9527a3fa41 100644 --- a/client/gui-gtk-3.0/gui_main.c +++ b/client/gui-gtk-3.0/gui_main.c @@ -1851,6 +1851,7 @@ void ui_main(int argc, char **argv) editgui_free(); gtk_widget_destroy(toplevel_tabs); gtk_widget_destroy(toplevel); + menus_free(); message_buffer = NULL; /* Result of destruction of everything */ tileset_free_tiles(tileset); } diff --git a/client/gui-gtk-3.0/menu.c b/client/gui-gtk-3.0/menu.c index 867f4d663b..11e02eff01 100644 --- a/client/gui-gtk-3.0/menu.c +++ b/client/gui-gtk-3.0/menu.c @@ -2864,3 +2864,14 @@ void real_menus_init(void) menu_entry_set_active("FULL_SCREEN", GUI_GTK_OPTION(fullscreen)); } + +/************************************************************************** + Free resources allocated by the menu system. +**************************************************************************/ +void menus_free(void) +{ + if (ui_builder != NULL) { + g_object_unref(ui_builder); + ui_builder = NULL; + } +} diff --git a/client/gui-gtk-3.0/menu.h b/client/gui-gtk-3.0/menu.h index 4df2200a3c..2a7818f77a 100644 --- a/client/gui-gtk-3.0/menu.h +++ b/client/gui-gtk-3.0/menu.h @@ -19,5 +19,6 @@ #include "menu_g.h" GtkWidget *setup_menus(GtkWidget *window); +void menus_free(void); #endif /* FC__MENU_H */ diff --git a/client/gui-gtk-3.22/gui_main.c b/client/gui-gtk-3.22/gui_main.c index 94887c7369..9c9989171e 100644 --- a/client/gui-gtk-3.22/gui_main.c +++ b/client/gui-gtk-3.22/gui_main.c @@ -1935,6 +1935,7 @@ void ui_main(int argc, char **argv) editgui_free(); gtk_widget_destroy(toplevel_tabs); gtk_widget_destroy(toplevel); + menus_free(); message_buffer = NULL; /* Result of destruction of everything */ tileset_free_tiles(tileset); } diff --git a/client/gui-gtk-3.22/menu.c b/client/gui-gtk-3.22/menu.c index 1833178b4e..7aac72e481 100644 --- a/client/gui-gtk-3.22/menu.c +++ b/client/gui-gtk-3.22/menu.c @@ -2849,3 +2849,14 @@ void real_menus_init(void) menu_entry_set_active("FULL_SCREEN", GUI_GTK_OPTION(fullscreen)); } + +/************************************************************************** + Free resources allocated by the menu system. +**************************************************************************/ +void menus_free(void) +{ + if (ui_builder != NULL) { + g_object_unref(ui_builder); + ui_builder = NULL; + } +} diff --git a/client/gui-gtk-3.22/menu.h b/client/gui-gtk-3.22/menu.h index 0500e08460..1c16591409 100644 --- a/client/gui-gtk-3.22/menu.h +++ b/client/gui-gtk-3.22/menu.h @@ -19,5 +19,6 @@ #include "menu_g.h" GtkWidget *setup_menus(GtkWidget *window); +void menus_free(void); #endif /* FC__MENU_H */ -- 2.35.1