[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 20 07:54:23 UTC 2019


 vcl/unx/gtk3/gtk3gtkinst.cxx |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

New commits:
commit 58a3ed811ac501b99d38664eb89bbab4b283d2aa
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 19 20:43:27 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 20 09:52:50 2019 +0200

    Resolves: tdf#127646 remove undispatched events in dtor
    
    Change-Id: I8d18b0b667a905131fd0edee1f73ebab144e6307
    Reviewed-on: https://gerrit.libreoffice.org/79244
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index c1df1f534a43..c5a5043c4ee1 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -6836,19 +6836,27 @@ private:
     gulong m_nPopupMenuSignalId;
     gulong m_nDragBeginSignalId;
     gulong m_nDragEndSignalId;
+    ImplSVEvent* m_pChangeEvent;
 
     DECL_LINK(async_signal_changed, void*, void);
 
-    static void signalChanged(GtkTreeView*, gpointer widget)
+    void launch_signal_changed()
     {
-        GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
         //tdf#117991 selection change is sent before the focus change, and focus change
         //is what will cause a spinbutton that currently has the focus to set its contents
         //as the spin button value. So any LibreOffice callbacks on
         //signal-change would happen before the spinbutton value-change occurs.
         //To avoid this, send the signal-change to LibreOffice to occur after focus-change
         //has been processed
-        Application::PostUserEvent(LINK(pThis, GtkInstanceTreeView, async_signal_changed));
+        if (m_pChangeEvent)
+            Application::RemoveUserEvent(m_pChangeEvent);
+        m_pChangeEvent = Application::PostUserEvent(LINK(this, GtkInstanceTreeView, async_signal_changed));
+    }
+
+    static void signalChanged(GtkTreeView*, gpointer widget)
+    {
+        GtkInstanceTreeView* pThis = static_cast<GtkInstanceTreeView*>(widget);
+        pThis->launch_signal_changed();
     }
 
     static void signalRowActivated(GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*, gpointer widget)
@@ -7212,6 +7220,7 @@ public:
         , m_nPopupMenuSignalId(g_signal_connect(pTreeView, "popup-menu", G_CALLBACK(signalPopupMenu), this))
         , m_nDragBeginSignalId(g_signal_connect(pTreeView, "drag-begin", G_CALLBACK(signalDragBegin), this))
         , m_nDragEndSignalId(g_signal_connect(pTreeView, "drag-end", G_CALLBACK(signalDragEnd), this))
+        , m_pChangeEvent(nullptr)
     {
         m_pColumns = gtk_tree_view_get_columns(m_pTreeView);
         int nIndex(0);
@@ -8576,6 +8585,8 @@ public:
 
     virtual ~GtkInstanceTreeView() override
     {
+        if (m_pChangeEvent)
+            Application::RemoveUserEvent(m_pChangeEvent);
         g_signal_handler_disconnect(m_pTreeView, m_nDragEndSignalId);
         g_signal_handler_disconnect(m_pTreeView, m_nDragBeginSignalId);
         g_signal_handler_disconnect(m_pTreeView, m_nPopupMenuSignalId);
@@ -8605,6 +8616,7 @@ public:
 
 IMPL_LINK_NOARG(GtkInstanceTreeView, async_signal_changed, void*, void)
 {
+    m_pChangeEvent = nullptr;
     signal_changed();
 }
 


More information about the Libreoffice-commits mailing list