From b66c6aa88484ebe8a6b013bf5990c6be45e48892 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 13 Jan 2024 15:38:28 +0100 Subject: Add missing gdk_event_free (vcl/gtkinst) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8bef4c3303f8f2fd89c1cf7cec35536c38d9d4d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162001 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- vcl/unx/gtk3/gtkinst.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'vcl') diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 1dafaa04d595..8bdeb8621549 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 -- cgit