From 74ec4296d8acb532c24c973dbdb8875e23172834 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 13 Jan 2024 18:03:53 +0100 Subject: Add missing g_object_unref (vcl/gtksalmenu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I07db3d7a03da94b53ad49188c229c134dc2f663c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162003 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/unx/gtk3/gtksalmenu.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'vcl') diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index a510473650d6..699e0097b358 100644 --- a/vcl/unx/gtk3/gtksalmenu.cxx +++ b/vcl/unx/gtk3/gtksalmenu.cxx @@ -125,6 +125,7 @@ static void RemoveDisabledItemsFromNativeMenu(GLOMenu* pMenu, GList** pOldComman g_free(pSubCommand); } } + g_object_unref(pSubMenuModel); } } @@ -1361,7 +1362,8 @@ bool GtkSalMenu::NativeSetItemCommand( unsigned nSection, if ( aCurrentCommand == nullptr || g_strcmp0( aCurrentCommand, aCommand ) != 0 ) { - bool bOldHasSubmenu = g_lo_menu_get_submenu_from_item_in_section(pMenu, nSection, nItemPos) != nullptr; + GLOMenu* pSubMenuModel = g_lo_menu_get_submenu_from_item_in_section(pMenu, nSection, nItemPos); + bool bOldHasSubmenu = pSubMenuModel != nullptr; bSubMenuAddedOrRemoved = bOldHasSubmenu != bIsSubmenu; if (bSubMenuAddedOrRemoved) { @@ -1385,6 +1387,8 @@ bool GtkSalMenu::NativeSetItemCommand( unsigned nSection, g_lo_menu_set_action_and_target_value_to_item_in_section( pMenu, nSection, nItemPos, aItemCommand, pTarget ); pTarget = nullptr; } + if (bOldHasSubmenu) + g_object_unref(pSubMenuModel); g_free( aItemCommand ); } -- cgit