[Libreoffice-commits] .: 2 commits - sc/source toolkit/source vcl/inc

Stephan Bergmann sbergmann at kemper.freedesktop.org
Mon Jan 16 07:00:52 PST 2012


 sc/source/ui/unoobj/cellsuno.cxx  |    1 +
 toolkit/source/awt/vclxwindow.cxx |    2 +-
 vcl/inc/vcl/svapp.hxx             |   25 +++----------------------
 3 files changed, 5 insertions(+), 23 deletions(-)

New commits:
commit 1ef1781390845d03b6e1518bbac81b818be62f3d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 16 15:49:13 2012 +0100

    Revert RescheduleDuringAcquire, it leads to code being run w/o solar mutex.
    
    6a8fd4c76a969ac98d1aff91ff7442f43aee0006 claims that RescheduleDuringAcquire is
    necessary to prevent deadlocks, but fails to explain what those deadlocks look
    like (and the cited HH internal issue 163542 is not available for inspection).
    It does lead to code erroneously being called with unlocked solar mutex, leading
    to crashes like
    
    Thread 1:
     0  in com::sun::star::uno::BaseReference::is at solver/unxlngx6/inc/com/sun/star/uno/Reference.h:103
     1  in sdr::contact::ControlHolder::is at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:204
     2  in sdr::contact::ViewObjectContactOfUnoControl_Impl::hasControl at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:642
     3  in sdr::contact::ViewObjectContactOfUnoControl::isPrimitiveVisible at svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx:1815
     4  in sdr::contact::ViewObjectContact::getPrimitive2DSequenceHierarchy at svx/source/sdr/contact/viewobjectcontact.cxx:396
     5  in sdr::contact::ViewObjectContact::getPrimitive2DSequenceSubHierarchy at svx/source/sdr/contact/viewobjectcontact.cxx:428
     6  in sdr::contact::ViewObjectContactOfPageHierarchy::getPrimitive2DSequenceHierarchy at svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx:450
     7  in sdr::contact::ViewObjectContact::getPrimitive2DSequenceSubHierarchy at svx/source/sdr/contact/viewobjectcontact.cxx:428
     8  in sdr::contact::ViewObjectContactOfSdrPage::getPrimitive2DSequenceHierarchy at svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx:699
     9  in sdr::contact::ObjectContactOfPageView::DoProcessDisplay at svx/source/sdr/contact/objectcontactofpageview.cxx:248
     10 in sdr::contact::ObjectContactOfPageView::ProcessDisplay at svx/source/sdr/contact/objectcontactofpageview.cxx:132
     11 in SdrPageWindow::RedrawLayer at svx/source/svdraw/sdrpagewindow.cxx:391
     12 in SdrPageView::DrawLayer at svx/source/svdraw/svdpagv.cxx:398
     13 in SwViewImp::PaintLayer at sw/source/core/view/vdraw.cxx:148
     14 in SwRootFrm::Paint at sw/source/core/layout/paintfrm.cxx:2976
     15 in ViewShell::Paint at sw/source/core/view/viewsh.cxx:1678
     16 in SwCrsrShell::Paint at sw/source/core/crsr/crsrsh.cxx:1165
     17 in SwEditWin::Paint at sw/source/ui/docvw/edtwin2.cxx:535
     18 in Window::ImplCallPaint at vcl/source/window/window.cxx:2417
     19 in Window::ImplCallPaint at vcl/source/window/window.cxx:2441
     20 in Window::ImplCallPaint at vcl/source/window/window.cxx:2441
     21 in Window::ImplCallPaint at vcl/source/window/window.cxx:2441
     22 in Window::ImplCallPaint at vcl/source/window/window.cxx:2441
     23 in Window::ImplCallPaint at vcl/source/window/window.cxx:2441
     24 in Window::ImplCallPaint at vcl/source/window/window.cxx:2441
     25 in Window::ImplCallOverlapPaint at vcl/source/window/window.cxx:2477
     26 in Window::ImplHandlePaintHdl at vcl/source/window/window.cxx:2497
     27 in Window::LinkStubImplHandlePaintHdl at vcl/source/window/window.cxx:2491
     28 in Link::Call at solver/unxlngx6/inc/tools/link.hxx:140
     29 in Timer::Timeout at vcl/source/app/timer.cxx:256
     30 in Timer::ImplTimerCallbackProc at vcl/source/app/timer.cxx:144
     31 in SalTimer::CallCallback at vcl/inc/saltimer.hxx:66
     32 in SvpSalInstance::CheckTimeout at vcl/headless/svpinst.cxx:199
     33 in SvpSalInstance::Yield at vcl/headless/svpinst.cxx:310
     34 in ImplYield at vcl/source/app/svapp.cxx:455
     35 in Application::Reschedule at vcl/source/app/svapp.cxx:482
     36 in SolarMutexReleaser::~SolarMutexReleaser at solver/unxlngx6/inc/vcl/svapp.hxx:551
     37 in VCLXWindowImpl::OnProcessCallbacks at toolkit/source/awt/vclxwindow.cxx:320
     38 in VCLXWindowImpl::LinkStubOnProcessCallbacks at toolkit/source/awt/vclxwindow.cxx:291
     39 in Link::Call at solver/unxlngx6/inc/tools/link.hxx:140
     40 in ImplHandleUserEvent at vcl/source/window/winproc.cxx:1999
     41 in ImplWindowFrameProc at vcl/source/window/winproc.cxx:2571
     42 in SalFrame::CallCallback at vcl/inc/salframe.hxx:294
     43 in SvpSalInstance::Yield at vcl/headless/svpinst.cxx:299
     44 in ImplYield at vcl/source/app/svapp.cxx:455
     45 in Application::Yield at vcl/source/app/svapp.cxx:489
     46 in Application::Execute at vcl/source/app/svapp.cxx:432
     47 in desktop::Desktop::Main at desktop/source/app/app.cxx:1824
     48 in ImplSVMain at vcl/source/app/svmain.cxx:178
     49 in SVMain at vcl/source/app/svmain.cxx:215
     50 in soffice_main at desktop/source/app/sofficemain.cxx:67
     51 in sal_main at desktop/source/app/main.c:34
     52 in main at desktop/source/app/main.c:33
    
    Thread 2:
     0  __lll_unlock_wake at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:373
     1  in _L_unlock_657 from /lib64/libpthread-2.12.so
     2  in __pthread_mutex_unlock_usercnt at pthread_mutex_unlock.c:52
     3  __pthread_mutex_unlock at pthread_mutex_unlock.c:290
     4  in osl_releaseMutex at sal/osl/unx/mutex.c:179
     5  in vcl::SolarMutexObject::release at vcl/source/app/solarmutex.cxx:54
     6  in SalYieldMutex::release at vcl/generic/app/geninst.cxx:73
     7  in SolarMutexGuard::~SolarMutexGuard at solver/unxlngx6/inc/vcl/svapp.hxx:436
     8  in SfxBaseModel::close at sfx2/source/doc/sfxbasemodel.cxx:1500
     9  in SwXTextDocument::close at sw/source/ui/uno/unotxdoc.cxx:574
     10 in callVirtualMethod at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:155
     11 in cpp_call at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:392
     12 in bridges::cpp_uno::shared::unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:586
     13 in binaryurp::IncomingRequest::execute_throw at binaryurp/source/incomingrequest.cxx:263
     14 in binaryurp::IncomingRequest::execute at binaryurp/source/incomingrequest.cxx:89
     15 in binaryurp::(anonymous namespace)::request at binaryurp/source/reader.cxx:107
     16 in cppu_threadpool::JobQueue::enter at cppu/source/threadpool/jobqueue.cxx:121
     17 in cppu_threadpool::ORequestThread::run at cppu/source/threadpool/thread.cxx:222
     18 in cppu_requestThreadWorker at cppu/source/threadpool/thread.cxx:57
     19 in osl_thread_start_Impl at sal/osl/unx/thread.c:292
     20 in start_thread at pthread_create.c:301
     21 in clone at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
    
    Looks best to remove that strange feature again and, if deadlocks should
    resurface, how to fix them cleanly.

diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index 819c6d4..76eab5b 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -310,7 +310,7 @@ IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
     }
 
     {
-        SolarMutexReleaser aReleaseSolar( SolarMutexReleaser::RescheduleDuringAcquire );
+        SolarMutexReleaser aReleaseSolar;
         for (   CallbackArray::const_iterator loop = aCallbacksCopy.begin();
                 loop != aCallbacksCopy.end();
                 ++loop
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index ba33ee2..2c26c55 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -531,32 +531,13 @@ protected:
 class SolarMutexReleaser
 {
     sal_uLong mnReleased;
-    const bool  mbRescheduleDuringAcquire;
+
 public:
-    enum
-    {
-        RescheduleDuringAcquire = true
-    };
-    SolarMutexReleaser( const bool i_rescheduleDuringAcquire = false )
-        : mnReleased( Application::ReleaseSolarMutex())
-        , mbRescheduleDuringAcquire( i_rescheduleDuringAcquire )
-    {
-    }
+    SolarMutexReleaser(): mnReleased(Application::ReleaseSolarMutex()) {}
 
     ~SolarMutexReleaser()
     {
-        if ( mnReleased > 0 )
-        {
-            if ( mbRescheduleDuringAcquire )
-            {
-                while ( !Application::GetSolarMutex().tryToAcquire() )
-                {
-                    Application::Reschedule();
-                }
-                --mnReleased;
-            }
-            Application::AcquireSolarMutex( mnReleased );
-        }
+        Application::AcquireSolarMutex( mnReleased );
     }
 };
 
commit 973d92a2a27d63e1c5fd6858ca6b45565a722bec
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Jan 16 15:47:47 2012 +0100

    Missing SolarMutexGuard.

diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 2d3db0a..532bbbe 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3881,6 +3881,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
                         const uno::Reference<util::XSearchDescriptor>& xDesc )
                                                     throw(uno::RuntimeException)
 {
+    SolarMutexGuard aGuard;
     //  Wenn nichts gefunden wird, soll Null zurueckgegeben werden (?)
     uno::Reference<container::XIndexAccess> xRet;
     if ( pDocShell && xDesc.is() )


More information about the Libreoffice-commits mailing list