diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-04-11 23:15:23 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-04-12 15:17:03 +0200 |
commit | 6f047b5866ee7c3f707a4f12ef9f95e7dbdb6e93 (patch) | |
tree | 341a7c333dfaadf0e9e240330e158f67bb2a5203 /vcl/win | |
parent | 3bbd98301ad95a9aff74bd2ae08c1e2e04a0f10b (diff) |
WNT: check result of PostMessage()
... so the next time something overflows the main thread's message queue
it's easier to debug.
Change-Id: I90a35e46f3b2cab190c7da5e53024ec549159ac6
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/app/salinst.cxx | 5 | ||||
-rw-r--r-- | vcl/win/app/saltimer.cxx | 11 | ||||
-rw-r--r-- | vcl/win/gdi/salprn.cxx | 3 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 63 | ||||
-rw-r--r-- | vcl/win/window/salobj.cxx | 30 |
5 files changed, 88 insertions, 24 deletions
diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index a44e93068f7e..f47e5d86e406 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -869,7 +869,10 @@ void SalTimer::Start( sal_uLong nMS ) if ( pSalData->mpFirstInstance ) { if ( pSalData->mnAppThreadId != GetCurrentThreadId() ) - PostMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS ); + { + BOOL const ret = PostMessageW(pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } else SendMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS ); } diff --git a/vcl/win/app/saltimer.cxx b/vcl/win/app/saltimer.cxx index c6f04be986fe..30aa816745c1 100644 --- a/vcl/win/app/saltimer.cxx +++ b/vcl/win/app/saltimer.cxx @@ -81,7 +81,10 @@ void WinSalTimer::Start( sal_uLong nMS ) if ( pSalData->mpFirstInstance ) { if ( pSalData->mnAppThreadId != GetCurrentThreadId() ) - PostMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS ); + { + BOOL const ret = PostMessageW(pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } else SendMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_STARTTIMER, 0, (LPARAM)nMS ); } @@ -124,7 +127,11 @@ void CALLBACK SalTimerProc(PVOID, BOOLEAN) // always post message when the timer fires, we will remove the ones // that happened during execution of the callback later directly from // the message queue - PostMessageW(pSalData->mpFirstInstance->mhComWnd, SAL_MSG_TIMER_CALLBACK, 0, 0); + BOOL const ret = PostMessageW(pSalData->mpFirstInstance->mhComWnd, SAL_MSG_TIMER_CALLBACK, 0, 0); +#if OSL_DEBUG_LEVEL > 0 + if (0 == ret) // SEH prevents using SAL_WARN here? + fputs("ERROR: PostMessage() failed!", stderr); +#endif #if defined ( __MINGW32__ ) && !defined ( _WIN64 ) } diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 0ddcc82b2832..465cfe3b1a20 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1515,7 +1515,8 @@ bool WinSalPrinter::StartJob( const OUString* pFileName, bWhile = FALSE; } while ( bWhile ); - PostMessageW( GetSalData()->mpFirstInstance->mhComWnd, SAL_MSG_DUMMY, 0, 0 ); + BOOL const ret = PostMessageW(GetSalData()->mpFirstInstance->mhComWnd, SAL_MSG_DUMMY, 0, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); // bring up a file chooser if printing to file port but no file name given OUString aOutFileName; diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index f04d923c0063..7a6f5c68cab5 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -1061,7 +1061,9 @@ void WinSalFrame::ReleaseGraphics( SalGraphics* pGraphics ) bool WinSalFrame::PostEvent(ImplSVEvent* pData) { - return (bool)PostMessageW( mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData ); + BOOL const ret = PostMessageW(mhWnd, SAL_MSG_USEREVENT, 0, (LPARAM)pData); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + return static_cast<bool>(ret); } void WinSalFrame::SetTitle( const OUString& rTitle ) @@ -1207,7 +1209,10 @@ void WinSalFrame::Show( bool bVisible, bool bNoActivate ) // in the thread of the window, which has create this window. // We post this message to avoid deadlocks if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) - PostMessageW( mhWnd, SAL_MSG_SHOW, bVisible, bNoActivate ); + { + BOOL const ret = PostMessageW(mhWnd, SAL_MSG_SHOW, bVisible, bNoActivate); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } else ImplSalShow( mhWnd, bVisible, bNoActivate ); } @@ -2046,7 +2051,10 @@ void WinSalFrame::ToTop( sal_uInt16 nFlags ) // in the thread of the window, which has create this window. // We post this message to avoid deadlocks if ( GetSalData()->mnAppThreadId != GetCurrentThreadId() ) - PostMessageW( mhWnd, SAL_MSG_TOTOP, nFlags, 0 ); + { + BOOL const ret = PostMessageW( mhWnd, SAL_MSG_TOTOP, nFlags, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } else ImplSalToTop( mhWnd, nFlags ); } @@ -3036,7 +3044,8 @@ static long ImplHandleMouseMsg( HWND hWnd, UINT nMsg, vcl::Window *pWin = pFrame->GetWindow(); if( pWin && pWin->ImplGetWindowImpl()->mpFrameData->mnFocusId ) { - PostMessageW( hWnd, nMsg, wParam, lParam ); + BOOL const ret = PostMessageW( hWnd, nMsg, wParam, lParam ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); return 1; } } @@ -3769,7 +3778,8 @@ static bool ImplHandlePaintMsg( HWND hWnd ) { RECT* pRect = new RECT; CopyRect( pRect, &aUpdateRect ); - PostMessageW( hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0 ); + BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); } EndPaint( hWnd, &aPs ); } @@ -3805,7 +3815,10 @@ static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect ) delete pRect; } else - PostMessageW( hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0 ); + { + BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPAINT, (WPARAM)pRect, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect ) @@ -3947,7 +3960,10 @@ static void ImplHandleMoveMsg( HWND hWnd ) ImplSalYieldMutexRelease(); } else - PostMessageW( hWnd, SAL_MSG_POSTMOVE, 0, 0 ); + { + BOOL const ret = PostMessageW( hWnd, SAL_MSG_POSTMOVE, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } static void ImplCallSizeHdl( HWND hWnd ) @@ -3968,7 +3984,10 @@ static void ImplCallSizeHdl( HWND hWnd ) ImplSalYieldMutexRelease(); } else - PostMessageW( hWnd, SAL_MSG_POSTCALLSIZE, 0, 0 ); + { + BOOL const ret = PostMessageW( hWnd, SAL_MSG_POSTCALLSIZE, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } static void ImplHandleSizeMsg( HWND hWnd, WPARAM wParam, LPARAM lParam ) @@ -4023,7 +4042,10 @@ static void ImplHandleFocusMsg( HWND hWnd ) ImplSalYieldMutexRelease(); } else - PostMessageW( hWnd, SAL_MSG_POSTFOCUS, 0, 0 ); + { + BOOL const ret = PostMessageW( hWnd, SAL_MSG_POSTFOCUS, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } static void ImplHandleCloseMsg( HWND hWnd ) @@ -4039,7 +4061,10 @@ static void ImplHandleCloseMsg( HWND hWnd ) ImplSalYieldMutexRelease(); } else - PostMessageW( hWnd, WM_CLOSE, 0, 0 ); + { + BOOL const ret = PostMessageW( hWnd, WM_CLOSE, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } static long ImplHandleShutDownMsg( HWND hWnd ) @@ -4122,7 +4147,8 @@ static void ImplHandleForcePalette( HWND hWnd ) { if ( !ImplSalYieldMutexTryToAcquire() ) { - PostMessageW( hWnd, SAL_MSG_FORCEPALETTE, 0, 0 ); + BOOL const ret = PostMessageW( hWnd, SAL_MSG_FORCEPALETTE, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); return; } @@ -4172,9 +4198,15 @@ static LRESULT ImplHandlePalette( bool bFrame, HWND hWnd, UINT nMsg, if ( ImplSalYieldMutexTryToAcquire() ) bReleaseMutex = TRUE; else if ( nMsg == WM_QUERYNEWPALETTE ) - PostMessageW( hWnd, SAL_MSG_POSTQUERYNEWPAL, wParam, lParam ); + { + BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTQUERYNEWPAL, wParam, lParam); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } else /* ( nMsg == WM_PALETTECHANGED ) */ - PostMessageW( hWnd, SAL_MSG_POSTPALCHANGED, wParam, lParam ); + { + BOOL const ret = PostMessageW(hWnd, SAL_MSG_POSTPALCHANGED, wParam, lParam); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } WinSalVirtualDevice*pTempVD; @@ -5904,7 +5936,10 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP { MSG aMsg; if( ! PeekMessageW( &aMsg, 0, WM_PAINT, WM_PAINT, PM_NOREMOVE | PM_NOYIELD ) ) - PostMessageW( pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, nCurTime ); + { + BOOL const ret = PostMessageW(pSalData->mpFirstInstance->mhComWnd, SAL_MSG_POSTTIMER, 0, nCurTime); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } } } diff --git a/vcl/win/window/salobj.cxx b/vcl/win/window/salobj.cxx index 01a330c2d2f5..a0fb9c39ca05 100644 --- a/vcl/win/window/salobj.cxx +++ b/vcl/win/window/salobj.cxx @@ -112,7 +112,10 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) ImplSalYieldMutexRelease(); } else - PostMessageW( pObject->mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 ); + { + BOOL const ret = PostMessageW(pObject->mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } } else if ( pData->message == WM_KILLFOCUS ) @@ -129,7 +132,10 @@ LRESULT CALLBACK SalSysMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) ImplSalYieldMutexRelease(); } else - PostMessageW( pObject->mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 ); + { + BOOL const ret = PostMessageW(pObject->mhWnd, SALOBJ_MSG_POSTFOCUS, 0, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } } else pObject->mhLastFocusWnd = (HWND)pData->wParam; @@ -153,7 +159,10 @@ bool ImplSalPreDispatchMsg( MSG* pMsg ) ImplSalYieldMutexAcquireWithWait(); pObject = ImplFindSalObject( pMsg->hwnd ); if ( pObject && !pObject->IsMouseTransparent() ) - PostMessageW( pObject->mhWnd, SALOBJ_MSG_TOTOP, 0, 0 ); + { + BOOL const ret = PostMessageW(pObject->mhWnd, SALOBJ_MSG_TOTOP, 0, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } ImplSalYieldMutexRelease(); } @@ -288,7 +297,10 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l ImplSalYieldMutexAcquireWithWait(); pSysObj = GetSalObjWindowPtr( hWnd ); if ( pSysObj && !pSysObj->IsMouseTransparent() ) - PostMessageW( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); + { + BOOL const ret = PostMessageW( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } ImplSalYieldMutexRelease(); } break; @@ -302,7 +314,10 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l rDef = FALSE; } else - PostMessageW( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); + { + BOOL const ret = PostMessageW( hWnd, SALOBJ_MSG_TOTOP, 0, 0 ); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } break; case SALOBJ_MSG_POSTFOCUS: @@ -319,7 +334,10 @@ LRESULT CALLBACK SalSysObjWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM l ImplSalYieldMutexRelease(); } else - PostMessageW( hWnd, SALOBJ_MSG_POSTFOCUS, 0, 0 ); + { + BOOL const ret = PostMessageW(hWnd, SALOBJ_MSG_POSTFOCUS, 0, 0); + SAL_WARN_IF(0 == ret, "vcl", "ERROR: PostMessage() failed!"); + } rDef = FALSE; break; |