[libreoffice/f17] Resolves: rhbz#855541 XIOError handler multithread woes

Caolán McNamara caolanm at fedoraproject.org
Wed Sep 12 13:08:29 UTC 2012


commit 9b1059a6475386ded90cf5c8a13e4907d33aeee9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 12 14:07:47 2012 +0100

    Resolves: rhbz#855541 XIOError handler multithread woes

 ...bz-855541-XIOError-handler-multithread-wo.patch |   74 ++++++++++++++++++++
 libreoffice.spec                                   |    7 ++-
 2 files changed, 80 insertions(+), 1 deletions(-)
---
diff --git a/0001-Resolves-rhbz-855541-XIOError-handler-multithread-wo.patch b/0001-Resolves-rhbz-855541-XIOError-handler-multithread-wo.patch
new file mode 100644
index 0000000..fdf22d6
--- /dev/null
+++ b/0001-Resolves-rhbz-855541-XIOError-handler-multithread-wo.patch
@@ -0,0 +1,74 @@
+From b0759366fc6cdda2db2f2cb4208df36c1b1fe8fc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm at redhat.com>
+Date: Wed, 12 Sep 2012 13:44:09 +0100
+Subject: [PATCH] Resolves: rhbz#855541 XIOError handler multithread woes
+
+We have two threads using X, on an XIOError both
+threads call their XIOError handlers and two
+calls to exit trample all over eachother.
+
+Change-Id: I20defc6f84cc6ea2372a0d6c979e8078fe920a88
+---
+ vcl/unx/generic/app/saldata.cxx |  6 ++++++
+ vcl/unx/gtk/app/gtkdata.cxx     | 14 ++++++++++++++
+ 2 files changed, 20 insertions(+)
+
+diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx
+index 1fb6a7a..0596dce 100644
+--- a/vcl/unx/generic/app/saldata.cxx
++++ b/vcl/unx/generic/app/saldata.cxx
+@@ -322,6 +322,12 @@ int X11SalData::XErrorHdl( Display *pDisplay, XErrorEvent *pEvent )
+ 
+ int X11SalData::XIOErrorHdl( Display * )
+ {
++    if (::osl::Thread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
++    {
++        pthread_exit(NULL);
++        return 0;
++    }
++
+     /*  #106197# hack: until a real shutdown procedure exists
+      *  _exit ASAP
+      */
+diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
+index 8f3151c..867883f 100644
+--- a/vcl/unx/gtk/app/gtkdata.cxx
++++ b/vcl/unx/gtk/app/gtkdata.cxx
+@@ -526,6 +526,18 @@ GtkData::GtkData( SalInstance *pInstance )
+     m_aDispatchCondition = osl_createCondition();
+ }
+ 
++XIOErrorHandler aOrigXIOErrorHandler = NULL;
++
++int XIOErrorHdl(Display *pDisplay)
++{
++    if (::osl::Thread::getCurrentIdentifier() != Application::GetMainThreadIdentifier())
++    {
++        pthread_exit(NULL);
++        return 0;
++    }
++    return aOrigXIOErrorHandler ? aOrigXIOErrorHandler(pDisplay) : 0;
++}
++
+ GtkData::~GtkData()
+ {
+     Yield( true, true );
+@@ -545,6 +557,7 @@ GtkData::~GtkData()
+     osl_destroyCondition( m_aDispatchCondition );
+     osl_releaseMutex( m_aDispatchMutex );
+     osl_destroyMutex( m_aDispatchMutex );
++    XSetIOErrorHandler(aOrigXIOErrorHandler);
+ }
+ 
+ void GtkData::Dispose()
+@@ -664,6 +677,7 @@ void GtkData::Init()
+     // init gtk/gdk
+     gtk_init_check( &nParams, &pCmdLineAry );
+     gdk_error_trap_push();
++    aOrigXIOErrorHandler = XSetIOErrorHandler(XIOErrorHdl);
+ 
+     for (i = 0; i < nParams; i++ )
+         g_free( pCmdLineAry[i] );
+-- 
+1.7.11.4
+
diff --git a/libreoffice.spec b/libreoffice.spec
index c87bfa7..d983746 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -35,7 +35,7 @@ Summary:        Free Software Productivity Suite
 Name:           libreoffice
 Epoch:          1
 Version:        %{libo_version}.2
-Release:        4%{?dist}
+Release:        5%{?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
 Group:          Applications/Productivity
 URL:            http://www.documentfoundation.org/develop
@@ -153,6 +153,7 @@ Patch35: 0001-Resolves-rhbz-846775-Clipboard-must-be-disposed-befo.patch
 Patch36: 0001-Resolves-rhbz-842292-crash-in-calling-callback-whose.patch
 Patch37: 0001-Resolves-rhbz-855972-crash-on-switching-to-outline-v.patch
 Patch38: 0001-Do-not-check-the-stored-DIFAT-sector-count.patch
+Patch39: 0001-Resolves-rhbz-855541-XIOError-handler-multithread-wo.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -1021,6 +1022,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch36 -p1 -b .rhbz-842292-crash-in-calling-callback-whose.patch
 %patch37 -p1 -b .rhbz-855972-crash-on-switching-to-outline-v.patch
 %patch38 -p1 -b .Do-not-check-the-stored-DIFAT-sector-count.patch
+%patch39 -p1 -b .rhbz-855541-XIOError-handler-multithread-wo.patch
 
 # TODO: check this
 # these are horribly incomplete--empty translations and copied english
@@ -2307,6 +2309,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 %endif
 
 %changelog
+* Wed Sep 12 2012 Caolán McNamara <caolanm at redhat.com> - 1:3.5.6.2-5-UNBUILT
+- Resolves: rhbz#855541 XIOError handler multithread woes
+
 * Tue Sep 11 2012 Caolán McNamara <caolanm at redhat.com> - 1:3.5.6.2-4
 - Resolves: rhbz#855507 large ole2 compound files fail to load
 


More information about the scm-commits mailing list