From a2baea7faff31d26459dab3668a39eae85e4991b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:30 +0200 Subject: Adding upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- vcl/unx/gtk3/glomenu.cxx | 2 +- vcl/unx/gtk3/gtkinst.cxx | 22 ++++++++++++++++++++++ vcl/unx/gtk3/gtksalmenu.cxx | 7 ++++++- vcl/unx/gtk3/salnativewidgets-gtk.cxx | 1 + 4 files changed, 30 insertions(+), 2 deletions(-) (limited to 'vcl/unx/gtk3') diff --git a/vcl/unx/gtk3/glomenu.cxx b/vcl/unx/gtk3/glomenu.cxx index a391649bbb..779d20f9b8 100644 --- a/vcl/unx/gtk3/glomenu.cxx +++ b/vcl/unx/gtk3/glomenu.cxx @@ -560,8 +560,8 @@ g_lo_menu_new_submenu_in_item_in_section (GLOMenu *menu, g_menu_model_items_changed (G_MENU_MODEL (model), position, 1, 1); - g_object_unref (model); } + g_object_unref (model); } GLOMenu * diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index c76d6291ce..b8da4f7b7a 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -11097,10 +11097,16 @@ private: gtk_main_do_event(pKeyEvent); GdkEvent *pTriggerEvent = gtk_get_current_event(); + bool bEventOwnership = true; if (!pTriggerEvent) + { pTriggerEvent = pKeyEvent; + bEventOwnership = false; + } gtk_menu_popup_at_widget(m_pMenu, pWidget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, pTriggerEvent); + if (bEventOwnership) + gdk_event_free(pTriggerEvent); gdk_event_free(pKeyEvent); } @@ -11118,6 +11124,7 @@ private: { gdk_event_get_button(pEvent, &nButton); nTime = gdk_event_get_time(pEvent); + gdk_event_free(pEvent); } else { @@ -11459,8 +11466,12 @@ public: gtk_main_do_event(pKeyEvent); GdkEvent *pTriggerEvent = gtk_get_current_event(); + bool bEventOwnership = true; if (!pTriggerEvent) + { pTriggerEvent = pKeyEvent; + bEventOwnership = false; + } bool bSwapForRTL = SwapForRTL(pWidget); @@ -11478,6 +11489,8 @@ public: else gtk_menu_popup_at_rect(m_pMenu, widget_get_surface(pWidget), &aRect, GDK_GRAVITY_NORTH_EAST, GDK_GRAVITY_NORTH_WEST, pTriggerEvent); } + if (bEventOwnership) + gdk_event_free(pTriggerEvent); gdk_event_free(pKeyEvent); } @@ -11500,6 +11513,7 @@ public: if (!gdk_event_get_button(pEvent, &nButton)) nButton = 0; nTime = gdk_event_get_time(pEvent); + gdk_event_free(pEvent); } else { @@ -14136,6 +14150,8 @@ private: #if !GTK_CHECK_VERSION(4, 0, 0) GdkEvent *pEvent = gtk_get_current_event(); m_bChangedByMouse = pEvent && categorizeEvent(pEvent) == VclInputFlags::MOUSE; + if (pEvent) + gdk_event_free(pEvent); #else //TODO maybe iterate over gtk_widget_observe_controllers looking for a motion controller #endif @@ -15500,7 +15516,10 @@ public: GtkTreePath* end_path; if (!gtk_tree_view_get_visible_range(m_pTreeView, &start_path, &end_path)) + { + g_object_thaw_notify(G_OBJECT(m_pTreeModel)); return; + } GtkInstanceTreeIter aGtkIter(nullptr); gtk_tree_model_get_iter(m_pTreeModel, &aGtkIter.iter, start_path); @@ -16963,6 +16982,8 @@ private: atk_object_set_description(pChild, OUStringToOString(sTooltipText, RTL_TEXTENCODING_UTF8).getStr()); g_object_unref(pChild); + gtk_tree_path_free(pPath); + #endif } @@ -20340,6 +20361,7 @@ public: bFindButtonTextRenderer = false; } } + g_list_free(cells); // Seeing as GtkCellRendererPixbuf no longer takes a surface, then insert our own replacement // to render that instead here diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx index a510473650..ddfa5ef36b 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); } } @@ -830,6 +831,7 @@ bool GtkSalMenu::AddMenuBarButton(const SalMenuButtonItem& rNewItem) pImage = gtk_image_new_from_gicon(pIcon); #endif g_object_unref(pIcon); + g_bytes_unref(pBytes); } GtkWidget* pButton = AddButton(pImage); @@ -1361,7 +1363,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 +1388,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 ); } diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx index a3a82edaa1..bfdeed4238 100644 --- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx @@ -2332,6 +2332,7 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) gchar* pFontname = nullptr; g_object_get(pSettings, "gtk-font-name", &pFontname, nullptr); PangoFontDescription* pFontDesc = pango_font_description_from_string(pFontname); + g_free(pFontname); vcl::Font aFont(pango_to_vcl(pFontDesc, rSettings.GetUILanguageTag().getLocale())); pango_font_description_free(pFontDesc); #else -- cgit v1.2.3