[Libreoffice-commits] core.git: 5 commits - comphelper/source include/toolkit svx/source toolkit/source vcl/source vcl/unx

Michael Stahl mstahl at redhat.com
Wed Oct 2 14:59:12 PDT 2013


 comphelper/source/misc/accessiblecontexthelper.cxx |    4 ++-
 include/toolkit/controls/unocontrol.hxx            |    3 +-
 svx/source/fmcomp/fmgridif.cxx                     |    4 ++-
 toolkit/source/controls/unocontrol.cxx             |   27 +++++++++++++--------
 vcl/source/app/svapp.cxx                           |    2 +
 vcl/source/helper/lazydelete.cxx                   |    2 +
 vcl/unx/generic/dtrans/X11_selection.cxx           |   12 ++++++---
 vcl/unx/gtk/a11y/atklistener.cxx                   |   25 +++++++++++++++----
 8 files changed, 57 insertions(+), 22 deletions(-)

New commits:
commit 78f05c0a6514ca084051f16498513033dacb14aa
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 2 23:25:44 2013 +0200

    toolkit: avoid deadlock in UnoControl::setDesignMode()
    
    Avoid deadlock by disposing the accesibility context without the Mutex
    locked, since it will eventually try to acquire the SolarMutex...
    
    Thread 1 in UnoControl::getPosSize()
    calling from sdr::contact::ControlHolder::getPosSize()
    
    Thread 2 calling from UnoControl::setDesignMode()
    trying to get SolarMutex in VCLXWindow::disposing()
    
    Change-Id: I7d0ffe4fa0f8cd0c48e9b9b5e923ce229f97ca57

diff --git a/include/toolkit/controls/unocontrol.hxx b/include/toolkit/controls/unocontrol.hxx
index 6665166..15aa918 100644
--- a/include/toolkit/controls/unocontrol.hxx
+++ b/include/toolkit/controls/unocontrol.hxx
@@ -124,7 +124,8 @@ protected:
     void                                                                        ImplLockPropertyChangeNotification( const OUString& rPropertyName, bool bLock );
     void                                                                        ImplLockPropertyChangeNotifications( const ::com::sun::star::uno::Sequence< OUString >& rPropertyNames, bool bLock );
 
-    void                                                                        disposeAccessibleContext();
+    void DisposeAccessibleContext(::com::sun::star::uno::Reference<
+            ::com::sun::star::lang::XComponent> const& xContext);
 
     inline void setPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _xPeer)
     {
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 8d6e0752..358328b 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -787,7 +787,9 @@ void SAL_CALL FmXGridControl::setDesignMode(sal_Bool bOn) throw( RuntimeExceptio
         // dispose our current AccessibleContext, if we have one
         // (changing the design mode implies having a new implementation for this context,
         // so the old one must be declared DEFUNC)
-        disposeAccessibleContext();
+        DisposeAccessibleContext(
+                Reference<XComponent>(maAccessibleContext, UNO_QUERY));
+        maAccessibleContext.clear();
 
         // prepare firing an event
         aModeChangeEvent.Source = *this;
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 49333fc..5d6700e 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -333,12 +333,11 @@ void UnoControl::updateFromModel()
 // XTypeProvider
 IMPL_IMPLEMENTATION_ID( UnoControl )
 
-void UnoControl::disposeAccessibleContext()
+void
+UnoControl::DisposeAccessibleContext(Reference<XComponent> const& xContextComp)
 {
-    Reference< XComponent > xContextComp( maAccessibleContext.get(), UNO_QUERY );
-    if ( xContextComp.is() )
+    if (xContextComp.is())
     {
-        maAccessibleContext = NULL;
         try
         {
             xContextComp->removeEventListener( this );
@@ -354,6 +353,7 @@ void UnoControl::disposeAccessibleContext()
 void UnoControl::dispose(  ) throw(RuntimeException)
 {
     Reference< XWindowPeer > xPeer;
+    Reference<XComponent> xAccessibleComp;
     {
         ::osl::MutexGuard aGuard( GetMutex() );
         if( mbDisposePeer )
@@ -361,14 +361,16 @@ void UnoControl::dispose(  ) throw(RuntimeException)
             xPeer = mxPeer;
         }
         setPeer( NULL );
+        xAccessibleComp.set(maAccessibleContext, UNO_QUERY);
+        maAccessibleContext.clear();
     }
     if( xPeer.is() )
     {
         xPeer->dispose();
     }
 
-    // dispose and release our AccessibleContext
-    disposeAccessibleContext();
+    // dispose our AccessibleContext - without Mutex locked
+    DisposeAccessibleContext(xAccessibleComp);
 
     EventObject aDisposeEvent;
     aDisposeEvent.Source = static_cast< XAggregation* >( this );
@@ -1382,6 +1384,7 @@ void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
     ModeChangeEvent aModeChangeEvent;
 
     Reference< XWindow > xWindow;
+    Reference<XComponent> xAccessibleComp;
     {
         ::osl::MutexGuard aGuard( GetMutex() );
         if ( bOn == mbDesignMode )
@@ -1390,15 +1393,19 @@ void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
         // remember this
         mbDesignMode = bOn;
         xWindow = xWindow.query( getPeer() );
-        // dispose our current AccessibleContext, if we have one
-        // (changing the design mode implies having a new implementation for this context,
-        // so the old one must be declared DEFUNC)
-        disposeAccessibleContext();
+
+        xAccessibleComp.set(maAccessibleContext, UNO_QUERY);
+        maAccessibleContext.clear();
 
         aModeChangeEvent.Source = *this;
         aModeChangeEvent.NewMode = mbDesignMode ? OUString("design") : OUString("alive" );
     }
 
+    // dispose current AccessibleContext, if we have one - without Mutex lock
+    // (changing the design mode implies having a new implementation for this context,
+    // so the old one must be declared DEFUNC)
+    DisposeAccessibleContext(xAccessibleComp);
+
     // ajust the visibility of our window
     if ( xWindow.is() )
         xWindow->setVisible( !bOn );
commit cf88ebc1f7d358a1dcd9e5b49026194e05916896
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 2 23:20:25 2013 +0200

    vcl: avoid deadlock in X11 SelectionManager::shutdown()
    
    It is evidently possible that SelectionManager::run() exits while
    shutdown() is still trying to write to its end of the pipe, so close the
    pipe when run() exits to avoid that.
    
    (regression from ec5a7256ca549d358b9c5380194ea2d1b991a73e)
    
    Change-Id: Ibc2823c61ea5df5b5227676c6e37ae5de44cde6b

diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx
index 7a36159..2cdf21d 100644
--- a/vcl/unx/generic/dtrans/X11_selection.cxx
+++ b/vcl/unx/generic/dtrans/X11_selection.cxx
@@ -3782,6 +3782,10 @@ void SelectionManager::run( void* pThis )
             aLast = aNow;
         }
     }
+    // close write end on exit so write() fails and other thread does not block
+    // forever
+    close(This->m_EndThreadPipe[1]);
+    close(This->m_EndThreadPipe[0]);
 #if OSL_DEBUG_LEVEL > 1
     fprintf(stderr, "SelectionManager::run end\n" );
 #endif
@@ -3827,16 +3831,16 @@ void SelectionManager::shutdown() throw()
         aGuard.clear();
         while (osl_isThreadRunning(m_aThread))
         {
-            SolarMutexGuard guard2;
-            Application::Reschedule();
+            {   // drop mutex before write - otherwise may deadlock
+                SolarMutexGuard guard2;
+                Application::Reschedule();
+            }
             // trigger poll()'s wait end by writing a dummy value
             int dummy=0;
             dummy = write(m_EndThreadPipe[1], &dummy, 1);
         }
         osl_joinWithThread( m_aThread );
         osl_destroyThread( m_aThread );
-        close(m_EndThreadPipe[0]);
-        close(m_EndThreadPipe[1]);
         m_aThread = NULL;
         aGuard.reset();
     }
commit 970448ef96c8be8b282f91dc235cab518d941549
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 2 23:23:46 2013 +0200

    vcl: add some SolarMutex assertions
    
    Check that SolarMutex is locked after return from
    Yield(), and in LazyDelete::flush().
    
    Change-Id: I12ff312bd946b97b5f2c79169892719910884381

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index b96de57..987db60 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -364,6 +364,8 @@ inline void ImplYield( bool i_bWait, bool i_bAllEvents )
     pSVData->mpDefInst->Yield( i_bWait && !pSVData->maAppData.mbAppQuit && !pSVData->maAppData.mbNoYield, i_bAllEvents );
     pSVData->maAppData.mnDispatchLevel--;
 
+    DBG_TESTSOLARMUTEX(); // must be locked on return from Yield
+
     // flush lazy deleted objects
     if( pSVData->maAppData.mnDispatchLevel == 0 )
         vcl::LazyDelete::flush();
diff --git a/vcl/source/helper/lazydelete.cxx b/vcl/source/helper/lazydelete.cxx
index df4e93d..e3676dc 100644
--- a/vcl/source/helper/lazydelete.cxx
+++ b/vcl/source/helper/lazydelete.cxx
@@ -46,6 +46,8 @@ void LazyDelete::addDeletor( LazyDeletorBase* i_pDel )
 
 void LazyDelete::flush()
 {
+    DBG_TESTSOLARMUTEX(); // must be locked
+
     unsigned int nCount = lcl_aDeletors.size();
     for( unsigned int i = 0; i < nCount; i++ )
         delete lcl_aDeletors[i];
commit 4100e3b6204fc304cc7b60b9d7ff2af75118b805
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 2 23:00:09 2013 +0200

    rhbz#1001768: avoid deadlock in OAccessibleContextHelper::disposing()
    
    De facto this class is locked by SolarMutex, which is what the
    OExternalLockGuard actually locks;
    do not lock m_Mutex because it may cause deadlock.
    
    Change-Id: I88b226d73dbef9a5803347b0ac3191bec2ba4515

diff --git a/comphelper/source/misc/accessiblecontexthelper.cxx b/comphelper/source/misc/accessiblecontexthelper.cxx
index b3169fd..bb9047d 100644
--- a/comphelper/source/misc/accessiblecontexthelper.cxx
+++ b/comphelper/source/misc/accessiblecontexthelper.cxx
@@ -123,7 +123,9 @@ namespace comphelper
     //---------------------------------------------------------------------
     void SAL_CALL OAccessibleContextHelper::disposing()
     {
-        ::osl::ClearableMutexGuard aGuard( GetMutex() );
+        // rhbz#1001768: de facto this class is locked by SolarMutex;
+        // do not lock m_Mutex because it may cause deadlock
+        OMutexGuard aGuard( getExternalLock() );
 
         if ( m_pImpl->getClientId( ) )
         {
commit c3ef735fd5d8866c8ce28b89744150e733087427
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Oct 2 23:03:38 2013 +0200

    rhbz#1001768: AtkListener::disposing(): delay notification
    
    Frame #10 in libatk-bridge.so calls atk_misc_threads_enter(),
    and having a look at the RHEL 6.5 at-spi package in
    ./at-spi-1.28.1/atk-bridge/bridge.c there is always the same call
    pattern:
    
      bridge_threads_leave ();
      [one function call]
      bridge_threads_enter ();
    
    ... so the bridge_threads_leave() has called the VCL gtk-plug function
    GtkHookedYieldMutex::ThreadsLeave() which releases the SolarMutex.
    
    This is of course not a good idea while there is a Window being deleted,
    and is the reason why the same Window is being deleted in thread 1 and
    thread 2:
    
    31 0x00000fff94a5fc00 in Window::~Window (this=0xfff702b2d30,
    __in_chrg=<value optimized out>) at
    /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4272
    
    16 0x00000fff94a5fc00 in Window::~Window (this=0xfff702b2d30,
    __in_chrg=<value optimized out>) at
    /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4272
    
    Try to avoid the problem by delaying the
    atk_object_notify_state_change() that will release SolarMutex until idle,
    when deletion of the Window is finished.
    
    Thread 2 (Thread 0xfff4cbcf110 (LWP 17011)):
    2  0x0000008013c6e718 in .pthread_mutex_lock () from /lib64/libc.so.6
    3  0x000000801576e4fc in osl_acquireMutex (Mutex=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/sal/osl/unx/mutex.c:114
    4  0x00000fff963a7908 in acquire (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/osl/mutex.hxx:58
    5  ClearableGuard (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/osl/mutex.hxx:177
    6  cppu::WeakAggComponentImplHelperBase::dispose (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/cppuhelper/source/implbase.cxx:392
    7  0x00000fff5f1b3444 in comphelper::disposeComponent<com::sun::star::accessibility::XAccessible> (_rxComp=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/comphelper/types.hxx:114
    8  0x00000fff5f273ba8 in VCLXAccessibleToolBox::implReleaseToolboxItem (this=<value optimized out>, _rMapPos=<value optimized out>, _bNotifyRemoval=<value optimized out>, _bDispose=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/accessibility/source/standard/vclxaccessibletoolbox.cxx:326
    9  0x00000fff5f2747e4 in VCLXAccessibleToolBox::ProcessWindowEvent (this=0xfff5f8b8fe0, rVclWindowEvent=...) at /usr/src/debug/libreoffice-4.0.4.2/accessibility/source/standard/vclxaccessibletoolbox.cxx:612
    10 0x00000fff951e4ad4 in VCLXAccessibleComponent::WindowEventListener (this=0xfff5f8b8fe0, pEvent=0xfff4cbcc950) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxaccessiblecomponent.cxx:136
    11 0x00000fff951e4b20 in VCLXAccessibleComponent::LinkStubWindowEventListener (pThis=<value optimized out>, pCaller=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxaccessiblecomponent.cxx:121
    12 0x00000fff946dd420 in Call (this=0xfff702b32a0, pEvent=0xfff4cbcc950) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/tools/link.hxx:123
    13 VclEventListeners::Call (this=0xfff702b32a0, pEvent=0xfff4cbcc950) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/app/vclevent.cxx:66
    14 0x00000fff94a4bab0 in Window::CallEventListeners (this=0xfff702b2d30, nEvent=<value optimized out>, pData=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:5272
    15 0x00000fff94a4bc80 in Window::ImplCallEventListeners (this=<value optimized out>, nEvent=<value optimized out>, pData=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:5255
    16 0x00000fff94a5fc00 in Window::~Window (this=0xfff702b2d30, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4272
    17 0x00000fff94a61138 in Window::~Window (this=<value optimized out>, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4683
    18 0x00000fff951efcf0 in VCLXDevice::DestroyOutputDevice (this=0xfff6801f010) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxdevice.cxx:56
    19 0x00000fff952347a8 in VCLXWindow::dispose (this=0xfff6801f010) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxwindow.cxx:957
    20 0x00000fff953c5f28 in UnoWrapper::WindowDestroyed (this=<value optimized out>, pWindow=0xfff70115a80) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/helper/unowrapper.cxx:263
    21 0x00000fff94a60130 in Window::~Window (this=0xfff70115a80, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4334
    22 0x00000fff949cc8b4 in DockingAreaWindow::~DockingAreaWindow (this=0xfff70115a80, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/dockingarea.cxx:96
    23 0x00000fff949cc918 in DockingAreaWindow::~DockingAreaWindow (this=<value optimized out>, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/dockingarea.cxx:96
    24 0x00000fff951efcf0 in VCLXDevice::DestroyOutputDevice (this=0xfff6801c310) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxdevice.cxx:56
    25 0x00000fff952347a8 in VCLXWindow::dispose (this=0xfff6801c310) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxwindow.cxx:957
    26 0x00000fff953c5f28 in UnoWrapper::WindowDestroyed (this=<value optimized out>, pWindow=0xfff7001a320) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/helper/unowrapper.cxx:263
    27 0x00000fff94a60130 in Window::~Window (this=0xfff7001a320, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4334
    28 0x00000fff94a1f7fc in SystemWindow::~SystemWindow (this=0xfff7001a320, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/syswin.cxx:89
    29 0x00000fff94a6c744 in WorkWindow::~WorkWindow (this=<value optimized out>, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/wrkwin.cxx:150
    30 0x00000fff94a6c7e8 in WorkWindow::~WorkWindow (this=<value optimized out>, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/wrkwin.cxx:150
    31 0x00000fff951efcf0 in VCLXDevice::DestroyOutputDevice (this=0xfff8c486f48) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxdevice.cxx:56
    32 0x00000fff952347a8 in VCLXWindow::dispose (this=0xfff8c486f48) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxwindow.cxx:957
    33 0x00000fff88258ec0 in framework::Frame::impl_disposeContainerWindow (this=<value optimized out>, xWindow=...) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/services/frame.cxx:2689
    34 0x00000fff8826d71c in framework::Frame::dispose (this=0xfff8c308a08) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/services/frame.cxx:1887
    35 0x00000fff88263018 in framework::Frame::close (this=0xfff8c308a08, bDeliverOwnerShip=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/services/frame.cxx:1650
    36 0x00000fff88255908 in framework::Desktop::impl_closeFrames (this=<value optimized out>, bAllowUI=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/services/desktop.cxx:1928
    37 0x00000fff88256120 in framework::Desktop::terminate (this=0xfff8b3de388) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/services/desktop.cxx:292
    
    Thread 1 (Thread 0xfff930e82a0 (LWP 16956)):
    2  0x0000008013c6e718 in .pthread_mutex_lock () from /lib64/libc.so.6
    3  0x000000801576e4fc in osl_acquireMutex (Mutex=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/sal/osl/unx/mutex.c:114
    4  0x00000fff946cd114 in vcl::SolarMutexObject::acquire (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/app/solarmutex.cxx:35
    5  0x00000fff94a6ecb8 in SalYieldMutex::acquire (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/generic/app/geninst.cxx:49
    6  0x00000fff8c24cb90 in GtkHookedYieldMutex::acquire (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/unx/gtk/app/gtkinst.cxx:91
    7  0x00000fff8c24cd2c in GtkHookedYieldMutex::ThreadsEnter (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/unx/gtk/app/gtkinst.cxx:64
    8  0x00000fff8b6dfabc in ?? () from /usr/lib64/gtk-2.0/modules/libgail.so
    9  0x00000fff8b9f333c in .atk_misc_threads_enter () from /usr/lib64/libatk-1.0.so.0
    10 0x00000fff8c1d534c in ?? () from /usr/lib64/gtk-2.0/modules/libatk-bridge.so
    11 0x00000fff8c1d65fc in ?? () from /usr/lib64/gtk-2.0/modules/libatk-bridge.so
    12 0x00000fff936af4e0 in ?? () from /lib64/libgobject-2.0.so.0
    13 0x00000fff936b13d0 in .g_signal_emit_valist () from /lib64/libgobject-2.0.so.0
    14 0x00000fff936b18f8 in .g_signal_emit () from /lib64/libgobject-2.0.so.0
    15 0x00000fff8b9e5f3c in .atk_object_notify_state_change () from /usr/lib64/libatk-1.0.so.0
    16 0x00000fff8c23083c in AtkListener::disposing (this=0xfff5f98dbc8) at /usr/src/debug/libreoffice-4.0.4.2/vcl/unx/gtk/a11y/atklistener.cxx:81
    17 0x00000fff963aee2c in cppu::OInterfaceContainerHelper::disposeAndClear (this=<value optimized out>, rEvt=...) at /usr/src/debug/libreoffice-4.0.4.2/cppuhelper/source/interfacecontainer.cxx:316
    18 0x00000fff9659d944 in comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing (_nClient=<value optimized out>, _rxEventSource=...) at /usr/src/debug/libreoffice-4.0.4.2/comphelper/source/misc/accessibleeventnotifier.cxx:162
    19 0x00000fff9659b20c in comphelper::OAccessibleContextHelper::disposing (this=0xfff5f8bb7e0) at /usr/src/debug/libreoffice-4.0.4.2/comphelper/source/misc/accessiblecontexthelper.cxx:130
    20 0x00000fff5f275898 in VCLXAccessibleToolBoxItem::disposing (this=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/accessibility/source/standard/vclxaccessibletoolboxitem.cxx:265
    21 0x00000fff963a79fc in cppu::WeakAggComponentImplHelperBase::dispose (this=0xfff5f8bb7e0) at /usr/src/debug/libreoffice-4.0.4.2/cppuhelper/source/implbase.cxx:404
    22 0x00000fff5f1b3444 in comphelper::disposeComponent<com::sun::star::accessibility::XAccessible> (_rxComp=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/comphelper/types.hxx:114
    23 0x00000fff5f273ba8 in VCLXAccessibleToolBox::implReleaseToolboxItem (this=<value optimized out>, _rMapPos=<value optimized out>, _bNotifyRemoval=<value optimized out>, _bDispose=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/accessibility/source/standard/vclxaccessibletoolbox.cxx:326
    24 0x00000fff5f2747e4 in VCLXAccessibleToolBox::ProcessWindowEvent (this=0xfff5f8b8fe0, rVclWindowEvent=...) at /usr/src/debug/libreoffice-4.0.4.2/accessibility/source/standard/vclxaccessibletoolbox.cxx:612
    25 0x00000fff951e4ad4 in VCLXAccessibleComponent::WindowEventListener (this=0xfff5f8b8fe0, pEvent=0xfffdc31f990) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxaccessiblecomponent.cxx:136
    26 0x00000fff951e4b20 in VCLXAccessibleComponent::LinkStubWindowEventListener (pThis=<value optimized out>, pCaller=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/toolkit/source/awt/vclxaccessiblecomponent.cxx:121
    27 0x00000fff946dd420 in Call (this=0xfff702b32a0, pEvent=0xfffdc31f990) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/tools/link.hxx:123
    28 VclEventListeners::Call (this=0xfff702b32a0, pEvent=0xfffdc31f990) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/app/vclevent.cxx:66
    29 0x00000fff94a4bab0 in Window::CallEventListeners (this=0xfff702b2d30, nEvent=<value optimized out>, pData=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:5272
    30 0x00000fff94a4bc80 in Window::ImplCallEventListeners (this=<value optimized out>, nEvent=<value optimized out>, pData=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:5255
    31 0x00000fff94a5fc00 in Window::~Window (this=0xfff702b2d30, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/window.cxx:4272
    32 0x00000fff949d41c4 in DockingWindow::~DockingWindow (this=0xfff702b2d30, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/dockwin.cxx:473
    33 0x00000fff94a35944 in ToolBox::~ToolBox (this=0xfff702b2d30, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/window/toolbox.cxx:1698
    34 0x00000fff88343e40 in framework::ToolBar::~ToolBar (this=<value optimized out>, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/uielement/toolbar.cxx:35
    35 0x00000fff88343e88 in framework::ToolBar::~ToolBar (this=0xfff702b2d30, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/framework/source/uielement/toolbar.cxx:35
    36 0x00000fff94a66a00 in ~LazyDeletor (this=0xfff40007720, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/vcl/lazydelete.hxx:162
    37 vcl::LazyDeletor<Window>::~LazyDeletor (this=0xfff40007720, __in_chrg=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/solver/unxlngppc64.pro/inc/vcl/lazydelete.hxx:164
    38 0x00000fff94998868 in vcl::LazyDelete::flush () at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/helper/lazydelete.cxx:54
    39 0x00000fff946d2294 in ImplYield (i_bAllEvents=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/app/svapp.cxx:434
    40 Application::Yield (i_bAllEvents=<value optimized out>) at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/app/svapp.cxx:463
    41 0x00000fff946d22f8 in Application::Execute () at /usr/src/debug/libreoffice-4.0.4.2/vcl/source/app/svapp.cxx:408
    
    Change-Id: Ic742442dd6ffeba59655c2e66df8dbabc906f061

diff --git a/vcl/unx/gtk/a11y/atklistener.cxx b/vcl/unx/gtk/a11y/atklistener.cxx
index f4d02ce..2ff3f0c 100644
--- a/vcl/unx/gtk/a11y/atklistener.cxx
+++ b/vcl/unx/gtk/a11y/atklistener.cxx
@@ -33,6 +33,7 @@
 
 #include "atklistener.hxx"
 #include "atkwrapper.hxx"
+#include "vcl/svapp.hxx"
 
 #include <rtl/ref.hxx>
 #include <stdio.h>
@@ -66,6 +67,23 @@ AtkStateType mapState( const uno::Any &rAny )
 
 /*****************************************************************************/
 
+extern "C" {
+    // rhbz#1001768 - down to horrific problems releasing the solar mutex
+    // while destroying a Window - which occurs inside these notifications.
+    static gint
+    idle_defunc_state_change( AtkObject *atk_obj )
+    {
+        SolarMutexGuard aGuard;
+
+        // This is an equivalent to a state change to DEFUNC(T).
+        atk_object_notify_state_change( atk_obj, ATK_STATE_DEFUNCT, TRUE );
+        if( atk_get_focus_object() == atk_obj )
+            atk_focus_tracker_notify( NULL );
+        g_object_unref( G_OBJECT( atk_obj ) );
+        return FALSE;
+    }
+}
+
 // XEventListener implementation
 void AtkListener::disposing( const lang::EventObject& ) throw (uno::RuntimeException)
 {
@@ -77,11 +95,8 @@ void AtkListener::disposing( const lang::EventObject& ) throw (uno::RuntimeExcep
         // global mutex
         atk_object_wrapper_dispose( mpWrapper );
 
-        // This is an equivalent to a state change to DEFUNC(T).
-        atk_object_notify_state_change( atk_obj, ATK_STATE_DEFUNCT, TRUE );
-
-        if( atk_get_focus_object() == atk_obj )
-            atk_focus_tracker_notify( NULL );
+        g_idle_add( (GSourceFunc) idle_defunc_state_change,
+                    g_object_ref( G_OBJECT( atk_obj ) ) );
 
         // Release the wrapper object so that it can vanish ..
         g_object_unref( mpWrapper );


More information about the Libreoffice-commits mailing list