vcl/unx/gtk3/gtk3gtkinst.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
New commits: commit 5cc194d452c8e52ebd7f5132912e97eabdb07595 Author: Caolán McNamara <[email protected]> AuthorDate: Thu Sep 19 20:43:27 2019 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Mon Sep 23 11:57:27 2019 +0200 Resolves: tdf#127646 remove undispatched events in dtor Change-Id: I8d18b0b667a905131fd0edee1f73ebab144e6307 Reviewed-on: https://gerrit.libreoffice.org/79257 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 0a2cb9d011b2..05f0a341b9fd 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -6453,19 +6453,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) @@ -6829,6 +6837,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); @@ -8155,6 +8164,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); @@ -8184,6 +8195,7 @@ public: IMPL_LINK_NOARG(GtkInstanceTreeView, async_signal_changed, void*, void) { + m_pChangeEvent = nullptr; signal_changed(); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
