[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - vcl/inc vcl/win

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 16 18:35:00 UTC 2019


 vcl/inc/win/saltimer.h   |    4 ++--
 vcl/win/app/salinst.cxx  |   25 ++++++++++++++-----------
 vcl/win/app/saltimer.cxx |   14 +++++++++-----
 3 files changed, 25 insertions(+), 18 deletions(-)

New commits:
commit f08ab14261dbeeaf9657fb6521935f7b700c2214
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Mon Oct 16 16:59:45 2017 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Wed Jan 16 19:34:35 2019 +0100

    WIN guarantee direct timeout handling
    
    The code did acccount processing of an invaild timeout system
    message as a valid timeout event.
    
    Change-Id: I3c31f8b9cec592631b4089411163dadecffde816
    Reviewed-on: https://gerrit.libreoffice.org/43529
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
    Reviewed-on: https://gerrit.libreoffice.org/66453
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/vcl/inc/win/saltimer.h b/vcl/inc/win/saltimer.h
index d762b51b6716..b7d1a1e0d0f1 100644
--- a/vcl/inc/win/saltimer.h
+++ b/vcl/inc/win/saltimer.h
@@ -42,9 +42,9 @@ class WinSalTimer final : public SalTimer, protected VersionedEvent
 
     void ImplStart( sal_uIntPtr nMS );
     void ImplStop();
-    void ImplHandleTimerEvent( WPARAM aWPARAM );
+    bool ImplHandleTimerEvent( WPARAM aWPARAM );
     void ImplHandleElapsedTimer();
-    void ImplHandle_WM_TIMER( WPARAM aWPARAM );
+    bool ImplHandle_WM_TIMER( WPARAM aWPARAM );
 
 public:
     WinSalTimer();
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index 75dce1c1edef..7117ef48de1f 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -562,17 +562,15 @@ void WinSalInstance::AcquireYieldMutex( sal_uLong nCount )
     ImplSalAcquireYieldMutex( nCount );
 }
 
-static void ImplSalDispatchMessage( MSG* pMsg )
+static LRESULT ImplSalDispatchMessage( MSG* pMsg )
 {
     SalData* pSalData = GetSalData();
-    if ( pSalData->mpFirstObject )
-    {
-        if ( ImplSalPreDispatchMsg( pMsg ) )
-            return;
-    }
+    if ( pSalData->mpFirstObject && ImplSalPreDispatchMsg( pMsg ) )
+        return 0;
     LRESULT lResult = DispatchMessageW( pMsg );
     if ( pSalData->mpFirstObject )
         ImplSalPostDispatchMsg( pMsg, lResult );
+    return lResult;
 }
 
 bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
@@ -594,10 +592,13 @@ bool ImplSalYield( bool bWait, bool bHandleAllCurrentEvents )
         if ( bOneEvent )
         {
             bWasMsg = true;
-            if ( !bWasTimeoutMsg )
-                bWasTimeoutMsg = (SAL_MSG_TIMER_CALLBACK == aMsg.message);
             TranslateMessage( &aMsg );
-            ImplSalDispatchMessage( &aMsg );
+            LRESULT nRet = ImplSalDispatchMessage( &aMsg );
+
+            if ( !bWasTimeoutMsg )
+                bWasTimeoutMsg = (SAL_MSG_TIMER_CALLBACK == aMsg.message)
+                    && static_cast<bool>( nRet );
+
             if ( bHandleAllCurrentEvents
                     && !bHadNewerEvent && aMsg.time > nCurTicks
                     && (nLastTicks <= nCurTicks || aMsg.time < nLastTicks) )
@@ -758,14 +759,16 @@ LRESULT CALLBACK SalComWndProc( HWND, UINT nMsg, WPARAM wParam, LPARAM lParam, i
         {
             WinSalTimer *const pTimer = static_cast<WinSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
             assert( pTimer != nullptr );
-            pTimer->ImplHandleTimerEvent( wParam );
+            nRet = static_cast<LRESULT>( pTimer->ImplHandleTimerEvent( wParam ) );
+            rDef = FALSE;
             break;
         }
         case WM_TIMER:
         {
             WinSalTimer *const pTimer = static_cast<WinSalTimer*>( ImplGetSVData()->maSchedCtx.mpSalTimer );
             assert( pTimer != nullptr );
-            pTimer->ImplHandle_WM_TIMER( wParam );
+            nRet = static_cast<LRESULT>( pTimer->ImplHandle_WM_TIMER( wParam ) );
+            rDef = FALSE;
             break;
         }
     }
diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx
index 6fdd1a3b3e86..793e37494348 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -175,13 +175,14 @@ void WinSalTimer::ImplHandleElapsedTimer()
     ImplSalYieldMutexRelease();
 }
 
-void WinSalTimer::ImplHandleTimerEvent( const WPARAM aWPARAM )
+bool WinSalTimer::ImplHandleTimerEvent( const WPARAM aWPARAM )
 {
     assert( aWPARAM <= SAL_MAX_INT32 );
     if ( !IsValidEventVersion( static_cast<sal_Int32>( aWPARAM ) ) )
-        return;
+        return false;
 
     ImplHandleElapsedTimer();
+    return true;
 }
 
 void WinSalTimer::SetForceRealTimer( const bool bVal )
@@ -196,11 +197,14 @@ void WinSalTimer::SetForceRealTimer( const bool bVal )
         Start( 0 );
 }
 
-void WinSalTimer::ImplHandle_WM_TIMER( const WPARAM aWPARAM )
+bool WinSalTimer::ImplHandle_WM_TIMER( const WPARAM aWPARAM )
 {
     assert( m_aWmTimerId == aWPARAM );
-    if ( m_aWmTimerId == aWPARAM && m_bDirectTimeout && m_bForceRealTimer )
-        ImplHandleElapsedTimer();
+    if ( !(m_aWmTimerId == aWPARAM && m_bDirectTimeout && m_bForceRealTimer) )
+        return false;
+
+    ImplHandleElapsedTimer();
+    return true;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list