[Libreoffice-commits] core.git: 6 commits - basegfx/source framework/source tools/source vcl/headless vcl/source

Jan-Marek Glogowski glogow at fbihome.de
Tue Aug 22 09:00:24 UTC 2017


 basegfx/source/vector/b3dvector.cxx              |    2 -
 framework/source/layoutmanager/layoutmanager.cxx |   11 ++++-----
 tools/source/datetime/ttime.cxx                  |    2 -
 vcl/headless/svpinst.cxx                         |    9 +++++--
 vcl/source/app/scheduler.cxx                     |   28 +++++++++++++++--------
 5 files changed, 33 insertions(+), 19 deletions(-)

New commits:
commit 87848afb9981234071efa6e2c061e1e55a712654
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Fri Aug 18 20:14:59 2017 +0200

    loplugin:unnecessaryparen
    
    Change-Id: I4f8b76a9f924a476d04aa745837e732b10348ffa

diff --git a/basegfx/source/vector/b3dvector.cxx b/basegfx/source/vector/b3dvector.cxx
index 88fe80549643..fc20d37494b3 100644
--- a/basegfx/source/vector/b3dvector.cxx
+++ b/basegfx/source/vector/b3dvector.cxx
@@ -81,7 +81,7 @@ namespace basegfx
         if(!fTools::equal(rVecA.getX() * rVecB.getZ(), rVecA.getZ() * rVecB.getX()))
             return false;
 
-        return (fTools::equal(rVecA.getY() * rVecB.getZ(), rVecA.getZ() * rVecB.getY()));
+        return fTools::equal(rVecA.getY() * rVecB.getZ(), rVecA.getZ() * rVecB.getY());
     }
 
 } // end of namespace basegfx
commit 11403bc18ba1b7c7fd099e9b9aa0b61cefdd1287
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Aug 15 09:03:49 2017 +0200

    Abort on critical Scheduler problems
    
    We don't have the possibility to continue processing tasks without
    the scheduler lock. Same situation, if a task throws an exception.
    In both cases we just abort() instead of using assertions.
    
    Change-Id: I4d52a6ef0526a1e46b64f9f3a6e0cc1a718618cc

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 0d3fb2f8ba0b..bdd5ad69d202 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -124,20 +124,23 @@ void Scheduler::ImplDeInitScheduler()
 
 void SchedulerMutex::acquire( sal_uInt32 nLockCount )
 {
+    assert(nLockCount > 0);
     for (sal_uInt32 i = 0; i != nLockCount; ++i) {
-        bool ok = maMutex.acquire();
-        assert(ok); (void) ok;
-        ++mnLockDepth;
+        if (!maMutex.acquire())
+            abort();
     }
+    mnLockDepth += nLockCount;
 }
 
 sal_uInt32 SchedulerMutex::release( bool bUnlockAll )
 {
-    assert(mnLockDepth != 0);
-    sal_uInt32 nLockCount = bUnlockAll ? mnLockDepth : 1;
+    assert(mnLockDepth > 0);
+    const sal_uInt32 nLockCount =
+        (bUnlockAll || 0 == mnLockDepth) ? mnLockDepth : 1;
     mnLockDepth -= nLockCount;
     for (sal_uInt32 i = 0; i != nLockCount; ++i) {
-        maMutex.release();
+        if (!maMutex.release())
+            abort();
     }
     return nLockCount;
 }
@@ -373,7 +376,16 @@ next_entry:
         // not run a nested Scheduler loop and don't need a stack push!
         pMostUrgent->mbInScheduler = true;
         sal_uInt32 nLockCount = Unlock( true );
-        pTask->Invoke();
+        try
+        {
+            pTask->Invoke();
+        }
+        catch (...)
+        {
+            SAL_WARN( "vcl.schedule",
+                      "Uncaught exception during Task::Invoke()!" );
+            abort();
+        }
         Lock( nLockCount );
         pMostUrgent->mbInScheduler = false;
 
commit cb8bfa9a32799bcde4e960fa56e388d5f7b2a928
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Aug 15 09:02:16 2017 +0200

    SVP always drain the wakeup pipe
    
    When we have a lot of idle tasks and generate new tasks, the wakeup
    pipe fills and is never drained, so OSL_ENSURE in Wakeup() starts
    to fail. This simply drains the pipe on every run, which processed
    an event.
    
    Change-Id: I7b6366b2649133b63138dc77fe51508404132890

diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx
index 4b76f0c3fbec..4ebeac8f4a3c 100644
--- a/vcl/headless/svpinst.cxx
+++ b/vcl/headless/svpinst.cxx
@@ -370,6 +370,12 @@ bool SvpSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents, sal_uLong
 
         DoReleaseYield(nTimeoutMS);
     }
+    else if ( bEvent )
+    {
+        // Drain the wakeup pipe
+        int buffer;
+        while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0);
+    }
 
     return bEvent;
 }
@@ -394,8 +400,7 @@ void SvpSalInstance::DoReleaseYield( int nTimeoutMS )
     if( (aPoll.revents & POLLIN) != 0 )
     {
         int buffer;
-        while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0)
-            continue;
+        while (read (m_pTimeoutFDS[0], &buffer, sizeof(buffer)) > 0);
     }
 }
 
commit e485703d3e5eaabe5f1bfd900a3ff205a8a84a35
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Aug 15 07:52:12 2017 +0200

    Really run the layouter every 50ms
    
    By Start()-ing the Idle, it's always reset, so with fast
    resizes you could actually postpone layouting indefinitly.
    
    Change-Id: Ie90b6f3f378ee8d163f621fce51280e09c826f14

diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 373b2c73e159..a8dca9cc3fce 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -2199,9 +2199,9 @@ void SAL_CALL LayoutManager::unlock()
     // conform to documentation: unlock with lock count == 0 means force a layout
 
     SolarMutexClearableGuard aWriteLock;
-        if ( bDoLayout )
-                m_aAsyncLayoutTimer.Stop();
-        aWriteLock.clear();
+    if ( bDoLayout )
+        m_aAsyncLayoutTimer.Stop();
+    aWriteLock.clear();
 
     Any a( nLockCount );
     implts_notifyListeners( frame::LayoutManagerEvents::UNLOCK, a );
@@ -2598,9 +2598,9 @@ void SAL_CALL LayoutManager::windowResized( const awt::WindowEvent& aEvent )
         if ( !m_aAsyncLayoutTimer.IsActive() )
         {
             m_aAsyncLayoutTimer.Invoke();
+            if ( m_nLockCount == 0 )
+                m_aAsyncLayoutTimer.Start();
         }
-        if ( m_nLockCount == 0 )
-            m_aAsyncLayoutTimer.Start();
     }
     else if ( m_xFrame.is() && aEvent.Source == m_xFrame->getContainerWindow() )
     {
@@ -2670,7 +2670,6 @@ void SAL_CALL LayoutManager::windowHidden( const lang::EventObject& aEvent )
 IMPL_LINK_NOARG(LayoutManager, AsyncLayoutHdl, Timer *, void)
 {
     SolarMutexClearableGuard aReadLock;
-    m_aAsyncLayoutTimer.Stop();
 
     if( !m_xContainerWindow.is() )
         return;
commit 168782a6e48fad98355a72e557402e66f7aa075d
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Wed Aug 9 17:48:48 2017 +0200

    Remove 500ns offset from GetSystemTicks()
    
    This doesn't make any sense. The orignal idea might have been to
    somehow be in the middle of 1ms, for whatever reason.
    
    And it completely breaks, if we want to sleep 0ms.
    
    Change-Id: I525b70c016876a96aa17edefe8c076b122ee2527

diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx
index 2c0ebe4a1b53..83812f72171a 100644
--- a/tools/source/datetime/ttime.cxx
+++ b/tools/source/datetime/ttime.cxx
@@ -433,7 +433,7 @@ sal_uInt64 tools::Time::GetSystemTicks()
         SAL_WARN("tools.datetime", "gettimeofday failed: " << e);
     }
     return static_cast<sal_uInt64>(tv.tv_sec) * 1000
-        + (static_cast<sal_uInt64>(tv.tv_usec) + 500) / 1000;
+        + static_cast<sal_uInt64>(tv.tv_usec) / 1000;
 #endif
 }
 
commit 3b9a535ee41e85fd30381432b245252d1e97b8f9
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Tue Aug 8 15:02:52 2017 +0200

    The scheduler timer starts without SolarMutex
    
    The backend is resposible to correctly start the timer.
    Otherwise you can't start new Tasks without the SolarMutex.
    
    Change-Id: I4e066fceb513d0de90b58854baf3e45f2b8ff25b

diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx
index 72653436e1c6..0d3fb2f8ba0b 100644
--- a/vcl/source/app/scheduler.cxx
+++ b/vcl/source/app/scheduler.cxx
@@ -170,8 +170,6 @@ void Scheduler::ImplStartTimer(sal_uInt64 nMS, bool bForce, sal_uInt64 nTime)
     if ( !rSchedCtx.mbActive )
         return;
 
-    DBG_TESTSOLARMUTEX();
-
     if (!rSchedCtx.mpSalTimer)
     {
         rSchedCtx.mnTimerStart = 0;


More information about the Libreoffice-commits mailing list