From 9cbe702b4f4e1a5ab8d9663454dcbbcec31b36d7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sep 20 2016 10:59:44 +0000 Subject: Related: rhbz#1362451 avoid recursive ownerchanged signal during ownerchange --- diff --git a/0001-Related-rhbz-1362451-avoid-recursive-ownerchanged-ha.patch b/0001-Related-rhbz-1362451-avoid-recursive-ownerchanged-ha.patch new file mode 100644 index 0000000..c41e29c --- /dev/null +++ b/0001-Related-rhbz-1362451-avoid-recursive-ownerchanged-ha.patch @@ -0,0 +1,115 @@ +From ad28f8ab77abe1fbcbb6d338a0e7d866afd3573c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Thu, 1 Sep 2016 15:50:20 +0100 +Subject: [PATCH] Related: rhbz#1362451 avoid recursive ownerchanged handling + during ownerchange + +Change-Id: Id9c12b7ce6458348890d7c7ff7fdb2cd37c4601c +--- + vcl/unx/gtk3/gtk3gtkinst.cxx | 55 ++++++++++++++++++++++++++------------------ + 1 file changed, 32 insertions(+), 23 deletions(-) + +diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx +index 3822ae4..2f85c16 100644 +--- a/vcl/unx/gtk3/gtk3gtkinst.cxx ++++ b/vcl/unx/gtk3/gtk3gtkinst.cxx +@@ -364,6 +364,29 @@ namespace + } + } + ++namespace ++{ ++ void ClipboardGetFunc(GtkClipboard *clipboard, GtkSelectionData *selection_data, ++ guint info, ++ gpointer user_data_or_owner) ++ { ++ VclGtkClipboard* pThis = static_cast(user_data_or_owner); ++ pThis->ClipboardGet(clipboard, selection_data, info); ++ } ++ ++ void ClipboardClearFunc(GtkClipboard *clipboard, gpointer user_data_or_owner) ++ { ++ VclGtkClipboard* pThis = static_cast(user_data_or_owner); ++ pThis->ClipboardClear(clipboard); ++ } ++ ++ void handle_owner_change(GtkClipboard *clipboard, GdkEvent *event, gpointer user_data) ++ { ++ VclGtkClipboard* pThis = static_cast(user_data); ++ pThis->OwnerPossiblyChanged(clipboard, event); ++ } ++} ++ + void VclGtkClipboard::OwnerPossiblyChanged(GtkClipboard* clipboard, GdkEvent* /*event*/) + { + if (!m_aContents.is()) +@@ -376,6 +399,10 @@ void VclGtkClipboard::OwnerPossiblyChanged(GtkClipboard* clipboard, GdkEvent* /* + //our pid, in which case it's us. + bool bSelf = false; + ++ //disconnect and reconnect after gtk_clipboard_wait_for_targets to ++ //avoid possible recursion ++ g_signal_handler_disconnect(clipboard, m_nOwnerChangedSignalId); ++ + OString sTunnel = "application/x-libreoffice-internal-id-" + getPID(); + GdkAtom *targets; + gint n_targets; +@@ -394,6 +421,9 @@ void VclGtkClipboard::OwnerPossiblyChanged(GtkClipboard* clipboard, GdkEvent* /* + g_free(targets); + } + ++ m_nOwnerChangedSignalId = g_signal_connect(clipboard, "owner-change", ++ G_CALLBACK(handle_owner_change), this); ++ + if (!bSelf) + { + //null out m_aContents to return control to the system-one which +@@ -486,29 +516,6 @@ void VclToGtkHelper::setSelectionData(const Reference(user_data_or_owner); +- pThis->ClipboardGet(clipboard, selection_data, info); +- } +- +- void ClipboardClearFunc(GtkClipboard *clipboard, gpointer user_data_or_owner) +- { +- VclGtkClipboard* pThis = reinterpret_cast(user_data_or_owner); +- pThis->ClipboardClear(clipboard); +- } +- +- void handle_owner_change(GtkClipboard *clipboard, GdkEvent *event, gpointer user_data) +- { +- VclGtkClipboard* pThis = static_cast(user_data); +- pThis->OwnerPossiblyChanged(clipboard, event); +- } +-} +- + VclGtkClipboard::VclGtkClipboard(GdkAtom nSelection) + : cppu::WeakComponentImplHelper +@@ -537,6 +544,7 @@ VclGtkClipboard::~VclGtkClipboard() + if (!m_aGtkTargets.empty()) + { + gtk_clipboard_clear(clipboard); ++ ClipboardClear(clipboard); + } + assert(m_aGtkTargets.empty()); + } +@@ -600,6 +608,7 @@ void VclGtkClipboard::setContents( + if (!m_aGtkTargets.empty()) + { + gtk_clipboard_clear(clipboard); ++ ClipboardClear(clipboard); + } + assert(m_aGtkTargets.empty()); + if (m_aContents.is()) +-- +2.7.4 + diff --git a/libreoffice.spec b/libreoffice.spec index 19e3bfa..f209fc4 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -286,6 +286,7 @@ Patch50: 0001-Resolves-tdf-101795-restore-hiding-on-end-of-Gtk-fpi.patch Patch51: 0001-consistent-ordering-of-the-file-template-list-across.patch Patch52: 0001-Related-rhbz-1353069-don-t-clear-XATTR_FILL-from-sty.patch Patch53: 0001-Resolves-tdf-102293-triple-click-results-in-visually.patch +Patch54: 0001-Related-rhbz-1362451-avoid-recursive-ownerchanged-ha.patch %if ! 0%{?rhel} Patch400: 0001-Update-liborcus-to-0.11.0.patch @@ -2357,8 +2358,9 @@ done %endif %changelog -* Mon Sep 19 2016 Caolán McNamara - 1:5.1.5.2-8 +* Tue Sep 20 2016 Caolán McNamara - 1:5.1.5.2-8 - Resolves: tdf#102293 triple click results in visually unselected word +- Related: rhbz#1362451 avoid recursive ownerchanged signal during ownerchange * Mon Sep 19 2016 Caolán McNamara - 1:5.1.5.2-7 - consistent ordering of the file template menu list across apps