vcl/inc/unx/gtk/gtkframe.hxx |    3 ---
 vcl/unx/gtk3/gtkframe.cxx    |   33 ++++++++++++++++-----------------
 2 files changed, 16 insertions(+), 20 deletions(-)

New commits:
commit bc8e1c3d3f471823dfd68beb8c7e0974be00f20e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Aug 30 11:43:59 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Aug 30 14:53:02 2022 +0200

    fix "g_object_weak_unref: couldn't find weak ref" warning
    
    (soffice:3465993): GLib-GObject-WARNING **: 11:33:34.451: 
g_object_weak_unref: couldn't find weak ref 0x7fffe9553580(0x7fffb4014180)
    
    do the same thing for all the gestures
    
    Change-Id: I944645fc3c95fd73186cd22e71738f247d864bb2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139031
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 29e1899df9de..8f2b8064fe9f 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -443,9 +443,6 @@ public:
     guint                           m_nHudAwarenessId;
     std::vector<gulong>             m_aMouseSignalIds;
 
-    GtkGesture                     *m_pZoomGesture;
-    GtkGesture                     *m_pRotateGesture;
-
     void grabPointer(bool bGrab, bool bKeyboardAlso, bool bOwnerEvents);
 
     static GtkSalDisplay*  getDisplay();
diff --git a/vcl/unx/gtk3/gtkframe.cxx b/vcl/unx/gtk3/gtkframe.cxx
index 8c59eed10389..39ed25e1ffa8 100644
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -713,9 +713,6 @@ GtkSalFrame::~GtkSalFrame()
     for (auto handler_id : m_aMouseSignalIds)
         g_signal_handler_disconnect(G_OBJECT(pEventWidget), handler_id);
 
-    g_clear_object(&m_pZoomGesture);
-    g_clear_object(&m_pRotateGesture);
-
 #if !GTK_CHECK_VERSION(4, 0, 0)
     if( m_pFixedContainer )
         gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) );
@@ -1023,30 +1020,32 @@ void GtkSalFrame::InitCommon()
 #endif
 
 #if GTK_CHECK_VERSION(4,0,0)
-    m_pZoomGesture = gtk_gesture_zoom_new();
-    gtk_widget_add_controller(pEventWidget, 
GTK_EVENT_CONTROLLER(m_pZoomGesture));
+    GtkGesture* pZoomGesture = gtk_gesture_zoom_new();
+    gtk_widget_add_controller(pEventWidget, 
GTK_EVENT_CONTROLLER(pZoomGesture));
 #else
-    m_pZoomGesture = gtk_gesture_zoom_new(GTK_WIDGET(pEventWidget));
+    GtkGesture* pZoomGesture = gtk_gesture_zoom_new(GTK_WIDGET(pEventWidget));
+    g_object_weak_ref(G_OBJECT(pEventWidget), 
reinterpret_cast<GWeakNotify>(g_object_unref), pZoomGesture);
 #endif
-    
gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER(m_pZoomGesture),
+    
gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER(pZoomGesture),
                                                GTK_PHASE_TARGET);
     // Note that the default zoom gesture signal handler needs to run first to 
setup correct
     // scale delta. Otherwise the first "begin" event will always contain 
scale delta of infinity.
-    g_signal_connect_after(m_pZoomGesture, "begin", 
G_CALLBACK(signalZoomBegin), this);
-    g_signal_connect_after(m_pZoomGesture, "update", 
G_CALLBACK(signalZoomUpdate), this);
-    g_signal_connect_after(m_pZoomGesture, "end", G_CALLBACK(signalZoomEnd), 
this);
+    g_signal_connect_after(pZoomGesture, "begin", G_CALLBACK(signalZoomBegin), 
this);
+    g_signal_connect_after(pZoomGesture, "update", 
G_CALLBACK(signalZoomUpdate), this);
+    g_signal_connect_after(pZoomGesture, "end", G_CALLBACK(signalZoomEnd), 
this);
 
 #if GTK_CHECK_VERSION(4,0,0)
-    m_pRotateGesture = gtk_gesture_rotate_new();
-    gtk_widget_add_controller(pEventWidget, 
GTK_EVENT_CONTROLLER(m_pRotateGesture));
+    GtkGesture* pRotateGesture = gtk_gesture_rotate_new();
+    gtk_widget_add_controller(pEventWidget, 
GTK_EVENT_CONTROLLER(pRotateGesture));
 #else
-    m_pRotateGesture = gtk_gesture_rotate_new(GTK_WIDGET(pEventWidget));
+    GtkGesture* pRotateGesture = 
gtk_gesture_rotate_new(GTK_WIDGET(pEventWidget));
+    g_object_weak_ref(G_OBJECT(pEventWidget), 
reinterpret_cast<GWeakNotify>(g_object_unref), pRotateGesture);
 #endif
-    
gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER(m_pRotateGesture),
+    
gtk_event_controller_set_propagation_phase(GTK_EVENT_CONTROLLER(pRotateGesture),
                                                GTK_PHASE_TARGET);
-    g_signal_connect(m_pRotateGesture, "begin", G_CALLBACK(signalRotateBegin), 
this);
-    g_signal_connect(m_pRotateGesture, "update", 
G_CALLBACK(signalRotateUpdate), this);
-    g_signal_connect(m_pRotateGesture, "end", G_CALLBACK(signalRotateEnd), 
this);
+    g_signal_connect(pRotateGesture, "begin", G_CALLBACK(signalRotateBegin), 
this);
+    g_signal_connect(pRotateGesture, "update", G_CALLBACK(signalRotateUpdate), 
this);
+    g_signal_connect(pRotateGesture, "end", G_CALLBACK(signalRotateEnd), this);
 
     //Drop Target Stuff
 #if GTK_CHECK_VERSION(4,0,0)

Reply via email to