[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann sbergman at redhat.com
Tue Aug 29 07:05:57 UTC 2017


 vcl/source/app/svapp.cxx |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit 5bcf4e98769dbaf07e8b28a86edc2d3d648a571c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Aug 29 08:58:34 2017 +0200

    Avoid deadlock under --enable-debug
    
    ...as seen during JunitTest_sc_unoapi_2 in an --enable-dbgutil build, where
    thread 1 owns the SolarMutex and tries to acquire the scheduler mutex while
    thread 7 owns the scheduler mutex and tries to re-acquire the SolarMutex.  Keep
    the SAL_WARN output about unprocessed idles just in case somebody considers it
    useful (but it needs to be taken with a grain of salt, of course).
    
    Change-Id: Ib83d02876dc0d3b3b9a4c08581edf9c378fc911b

diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index 5a5be865906f..fdbc5f9d9522 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -496,12 +496,6 @@ void Scheduler::ProcessEventsToSignal(bool& bSignal)
 void Scheduler::ProcessEventsToIdle()
 {
     int nSanity = 1;
-#if OSL_DEBUG_LEVEL > 0
-    const ImplSVData* pSVData = ImplGetSVData();
-    bool bIsMainThread = pSVData->mpDefInst->IsMainThread();
-    if ( bIsMainThread )
-        Scheduler::Lock();
-#endif
     while( Application::Reschedule( true ) )
     {
         if (0 == ++nSanity % 1000)
@@ -513,10 +507,10 @@ void Scheduler::ProcessEventsToIdle()
     // If we yield from a non-main thread we just can guarantee that all idle
     // events were processed at some point, but our check can't prevent further
     // processing in the main thread, which may add new events, so skip it.
-    if ( !bIsMainThread )
+    const ImplSVData* pSVData = ImplGetSVData();
+    if ( !pSVData->mpDefInst->IsMainThread() )
         return;
     const ImplSchedulerData* pSchedulerData = pSVData->maSchedCtx.mpFirstSchedulerData;
-    bool bAnyIdle = false;
     while ( pSchedulerData )
     {
         if ( pSchedulerData->mpTask && !pSchedulerData->mbInScheduler )
@@ -524,14 +518,11 @@ void Scheduler::ProcessEventsToIdle()
             Idle *pIdle = dynamic_cast<Idle*>( pSchedulerData->mpTask );
             if ( pIdle && pIdle->IsActive() )
             {
-                bAnyIdle = true;
                 SAL_WARN( "vcl.schedule", "Unprocessed Idle: " << pIdle->GetDebugName() );
             }
         }
         pSchedulerData = pSchedulerData->mpNext;
     }
-    assert( !bAnyIdle );
-    Scheduler::Unlock();
 #endif
 }
 


More information about the Libreoffice-commits mailing list