summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2017-10-16 16:59:45 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2017-10-20 10:45:58 +0200
commit47ee8098a90a35626dcace7422a9a624c8469389 (patch)
tree15bd87d280036aec701328ee8c770e3c4c9de138 /vcl/win
parent9466ea1af09c275f423b0d5c1ad929984ed998b3 (diff)
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@libreoffice.org> Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/app/salinst.cxx25
-rw-r--r--vcl/win/app/saltimer.cxx14
2 files changed, 23 insertions, 16 deletions
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx
index d1fc8adb6272..693411a0583c 100644
--- a/vcl/win/app/salinst.cxx
+++ b/vcl/win/app/salinst.cxx
@@ -459,17 +459,15 @@ void WinSalInstance::AcquireYieldMutex( sal_uInt32 nCount )
mpSalYieldMutex->acquire( 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 )
@@ -491,10 +489,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) )
@@ -666,14 +667,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 9d20c70bdb5a..9c67e841956e 100644
--- a/vcl/win/app/saltimer.cxx
+++ b/vcl/win/app/saltimer.cxx
@@ -158,13 +158,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 )
@@ -179,11 +180,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: */