[libreoffice/f21] Resolves: fdo#1167250 Crash in clipboard code

sbergmann sbergmann at fedoraproject.org
Mon Nov 24 13:27:04 UTC 2014


commit dc9c069ce699f153b29415eb9db7bd9ac7ae0b49
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Nov 24 14:26:52 2014 +0100

    Resolves: fdo#1167250 Crash in clipboard code

 ...0-Avoid-X11Clipboard-already-being-destro.patch |   99 ++++++++++++++++++++
 libreoffice.spec                                   |    6 +-
 2 files changed, 104 insertions(+), 1 deletions(-)
---
diff --git a/0001-rhbz-1167250-Avoid-X11Clipboard-already-being-destro.patch b/0001-rhbz-1167250-Avoid-X11Clipboard-already-being-destro.patch
new file mode 100644
index 0000000..aa69e1d
--- /dev/null
+++ b/0001-rhbz-1167250-Avoid-X11Clipboard-already-being-destro.patch
@@ -0,0 +1,99 @@
+From c0c0ad258144fc7ef27ff136ad333a68a273e901 Mon Sep 17 00:00:00 2001
+From: Stephan Bergmann <sbergman at redhat.com>
+Date: Mon, 24 Nov 2014 14:00:30 +0100
+Subject: [PATCH] rhbz#1167250: Avoid X11Clipboard already being destroyed in
+ constructor
+
+...via SelectionManager::run's aKeep acquring and releasing getReference()
+
+Change-Id: I18696d30c41ca9ae101261668cbf54cb0a6c45fc
+(cherry picked from commit 94d2de0ba1f010be7acf0d00ce5b2ed4ed2b895b)
+---
+ vcl/unx/generic/dtrans/X11_clipboard.cxx | 15 +++++++++++----
+ vcl/unx/generic/dtrans/X11_clipboard.hxx |  6 +++++-
+ vcl/unx/generic/dtrans/X11_service.cxx   |  4 ++--
+ 3 files changed, 18 insertions(+), 7 deletions(-)
+
+diff --git a/vcl/unx/generic/dtrans/X11_clipboard.cxx b/vcl/unx/generic/dtrans/X11_clipboard.cxx
+index 4e6b953..95d44a5 100644
+--- a/vcl/unx/generic/dtrans/X11_clipboard.cxx
++++ b/vcl/unx/generic/dtrans/X11_clipboard.cxx
+@@ -29,6 +29,7 @@
+ #include <uno/mapping.hxx>
+ #include <cppuhelper/factory.hxx>
+ #include <cppuhelper/supportsservice.hxx>
++#include <rtl/ref.hxx>
+ #include <rtl/tencinfo.h>
+ 
+ #if OSL_DEBUG_LEVEL > 1
+@@ -57,16 +58,22 @@ X11Clipboard::X11Clipboard( SelectionManager& rManager, Atom aSelection ) :
+ #if OSL_DEBUG_LEVEL > 1
+     fprintf( stderr, "creating instance of X11Clipboard (this=%p)\n", this );
+ #endif
++}
+ 
+-    if( m_aSelection != None )
++css::uno::Reference<css::datatransfer::clipboard::XClipboard>
++X11Clipboard::create( SelectionManager& rManager, Atom aSelection )
++{
++    rtl::Reference<X11Clipboard> cb(new X11Clipboard(rManager, aSelection));
++    if( aSelection != None )
+     {
+-        m_rSelectionManager.registerHandler( m_aSelection, *this );
++        rManager.registerHandler( aSelection, *cb.get() );
+     }
+     else
+     {
+-        m_rSelectionManager.registerHandler( XA_PRIMARY, *this );
+-        m_rSelectionManager.registerHandler( m_rSelectionManager.getAtom( OUString("CLIPBOARD") ), *this );
++        rManager.registerHandler( XA_PRIMARY, *cb.get() );
++        rManager.registerHandler( rManager.getAtom( OUString("CLIPBOARD") ), *cb.get() );
+     }
++    return cb.get();
+ }
+ 
+ X11Clipboard::~X11Clipboard()
+diff --git a/vcl/unx/generic/dtrans/X11_clipboard.hxx b/vcl/unx/generic/dtrans/X11_clipboard.hxx
+index 6269927..ba83636 100644
+--- a/vcl/unx/generic/dtrans/X11_clipboard.hxx
++++ b/vcl/unx/generic/dtrans/X11_clipboard.hxx
+@@ -46,6 +46,8 @@ namespace x11 {
+         ::std::list< css::uno::Reference< css::datatransfer::clipboard::XClipboardListener > > m_aListeners;
+         Atom                                                    m_aSelection;
+ 
++        X11Clipboard( SelectionManager& rManager, Atom aSelection );
++
+     protected:
+ 
+         friend class SelectionManager;
+@@ -55,7 +57,9 @@ namespace x11 {
+ 
+     public:
+ 
+-        X11Clipboard( SelectionManager& rManager, Atom aSelection );
++        static css::uno::Reference<css::datatransfer::clipboard::XClipboard>
++        create( SelectionManager& rManager, Atom aSelection );
++
+         virtual ~X11Clipboard();
+ 
+         static X11Clipboard* get( const OUString& rDisplayName, Atom aSelection );
+diff --git a/vcl/unx/generic/dtrans/X11_service.cxx b/vcl/unx/generic/dtrans/X11_service.cxx
+index 6d5a8fb..4ec02c1 100644
+--- a/vcl/unx/generic/dtrans/X11_service.cxx
++++ b/vcl/unx/generic/dtrans/X11_service.cxx
+@@ -77,10 +77,10 @@ css::uno::Reference< XInterface > X11SalInstance::CreateClipboard( const Sequenc
+     if( it != m_aInstances.end() )
+         return it->second;
+ 
+-    X11Clipboard* pClipboard = new X11Clipboard( rManager, nSelection );
++    css::uno::Reference<css::datatransfer::clipboard::XClipboard> pClipboard = X11Clipboard::create( rManager, nSelection );
+     m_aInstances[ nSelection ] = pClipboard;
+ 
+-    return static_cast<OWeakObject*>(pClipboard);
++    return pClipboard;
+ }
+ 
+ css::uno::Reference< XInterface > X11SalInstance::CreateDragSource()
+-- 
+1.9.3
+
diff --git a/libreoffice.spec b/libreoffice.spec
index ff0e531..c9d28f8 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -46,7 +46,7 @@ Summary:        Free Software Productivity Suite
 Name:           libreoffice
 Epoch:          1
 Version:        %{libo_version}.1
-Release:        6%{?libo_prerelease}%{?dist}
+Release:        7%{?libo_prerelease}%{?dist}
 License:        (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0
 Group:          Applications/Productivity
 URL:            http://www.libreoffice.org/
@@ -349,6 +349,7 @@ Patch50: 0001-officecfg-set-VCL.WM.ShouldSwitchWorkspace-to-false.patch
 Patch51: 0001-Resolves-fdo-86449-backport-rtf-fixes.patch
 Patch52: 0002-Resolves-fdo-86451-guard-all-the-tops-post-pop.patch
 Patch53: 0001-Resolves-fdo-86466-Wrong-background-color-shown-in-f.patch
+Patch54: 0001-rhbz-1167250-Avoid-X11Clipboard-already-being-destro.patch
 
 %define instdir %{_libdir}
 %define baseinstdir %{instdir}/libreoffice
@@ -2319,6 +2320,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %endif
 
 %changelog
+* Mon Nov 24 2014 Stephan Bergmann <sbergman at redhat.com>  - 1:4.3.4.1-7-UNBUILT
+- Resolves: fdo#1167250 Crash in clipboard code
+
 * Fri Nov 21 2014 Caolán McNamara <caolanm at redhat.com> - 1:4.3.4.1-6
 - Resolves: fdo#86466 Wrong background color shown in impress table
 


More information about the scm-commits mailing list