From 69a47ea451b5d6c5c5d7be5d9877ea2bdd0748fe Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Jul 12 2016 19:34:16 +0000 Subject: Related: rhbz#1351369 gtk3 clipboards have to live to end --- diff --git a/0001-Related-rhbz-1351369-gtk3-clipboards-have-to-live-to.patch b/0001-Related-rhbz-1351369-gtk3-clipboards-have-to-live-to.patch new file mode 100644 index 0000000..3348743 --- /dev/null +++ b/0001-Related-rhbz-1351369-gtk3-clipboards-have-to-live-to.patch @@ -0,0 +1,93 @@ +From 962e0bb4b31265b046fe4fb57d3087e20f5fe4ef Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 12 Jul 2016 20:31:52 +0100 +Subject: [PATCH] Related: rhbz#1351369 gtk3 clipboards have to live to end + once created + +like the other platforms do + +Change-Id: I31340254573d13dc808d1e3038e3a36ae97f6c22 +--- + vcl/inc/unx/gtk/gtkinst.hxx | 3 +++ + vcl/unx/gtk3/gtk3gtkinst.cxx | 22 +++++++++++++++++----- + 2 files changed, 20 insertions(+), 5 deletions(-) + +diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx +index 6212d5d..01e8ca6 100644 +--- a/vcl/inc/unx/gtk/gtkinst.hxx ++++ b/vcl/inc/unx/gtk/gtkinst.hxx +@@ -246,6 +246,9 @@ public: + + private: + std::vector m_aTimers; ++#if GTK_CHECK_VERSION(3,0,0) ++ std::unordered_map< GdkAtom, css::uno::Reference > m_aClipboards; ++#endif + bool IsTimerExpired(); + bool bNeedsInit; + +diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx +index b5db25d..3cc4046 100644 +--- a/vcl/unx/gtk3/gtk3gtkinst.cxx ++++ b/vcl/unx/gtk3/gtk3gtkinst.cxx +@@ -536,7 +536,11 @@ VclGtkClipboard::~VclGtkClipboard() + { + GtkClipboard* clipboard = gtk_clipboard_get(m_nSelection); + g_signal_handler_disconnect(clipboard, m_nOwnerChangedSignalId); +- ClipboardClear(nullptr); ++ if (!m_aGtkTargets.empty()) ++ { ++ gtk_clipboard_clear(clipboard); ++ } ++ assert(m_aGtkTargets.empty()); + } + + std::vector VclToGtkHelper::FormatsToGtk(const css::uno::Sequence &rFormats) +@@ -587,7 +591,6 @@ void VclGtkClipboard::setContents( + { + osl::ClearableMutexGuard aGuard( m_aMutex ); + Reference< datatransfer::clipboard::XClipboardOwner > xOldOwner( m_aOwner ); +- bool bOwnerChange = (xOldOwner.is() && xOldOwner != xClipboardOwner); + Reference< datatransfer::XTransferable > xOldContents( m_aContents ); + m_aContents = xTrans; + m_aOwner = xClipboardOwner; +@@ -596,8 +599,10 @@ void VclGtkClipboard::setContents( + datatransfer::clipboard::ClipboardEvent aEv; + + GtkClipboard* clipboard = gtk_clipboard_get(m_nSelection); +- if (bOwnerChange) ++ if (!m_aGtkTargets.empty()) ++ { + gtk_clipboard_clear(clipboard); ++ } + assert(m_aGtkTargets.empty()); + if (m_aContents.is()) + { +@@ -624,7 +629,7 @@ void VclGtkClipboard::setContents( + + aGuard.clear(); + +- if (bOwnerChange) ++ if (xOldOwner.is() && xOldOwner != xClipboardOwner) + xOldOwner->lostOwnership( this, xOldContents ); + for( std::list< Reference< datatransfer::clipboard::XClipboardListener > >::iterator it = + aListeners.begin(); it != aListeners.end() ; ++it ) +@@ -672,7 +677,14 @@ Reference< XInterface > GtkInstance::CreateClipboard(const Sequence< Any >& argu + + GdkAtom nSelection = (sel == "CLIPBOARD") ? GDK_SELECTION_CLIPBOARD : GDK_SELECTION_PRIMARY; + +- return Reference< XInterface >( static_cast(new VclGtkClipboard(nSelection)) ); ++ auto it = m_aClipboards.find(nSelection); ++ if (it != m_aClipboards.end()) ++ return it->second; ++ ++ Reference xClipboard(static_cast(new VclGtkClipboard(nSelection))); ++ m_aClipboards[nSelection] = xClipboard; ++ ++ return xClipboard; + } + + GtkDropTarget::GtkDropTarget() +-- +2.7.4 + diff --git a/libreoffice.spec b/libreoffice.spec index 4a72495..fd4d45b 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -240,6 +240,7 @@ Patch10: 0001-Resolves-rhbz-1353069-don-t-clear-XATTR_FILL-from-st.patch Patch11: 0001-Resolves-rhbz-1351224-wayland-grab-related-crashes.patch Patch12: 0001-Resolves-rhbz-1352965-gtk3-infinite-clipboard-recurs.patch Patch13: 0001-rhbz-1351292-correctly-set-edit-mode.patch +Patch14: 0001-Related-rhbz-1351369-gtk3-clipboards-have-to-live-to.patch %if 0%{?rhel} # not upstreamed