From 6f047b5866ee7c3f707a4f12ef9f95e7dbdb6e93 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 11 Apr 2016 23:15:23 +0200 Subject: 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 --- vcl/win/window/salframe.cxx | 63 +++++++++++++++++++++++++++++++++++---------- vcl/win/window/salobj.cxx | 30 ++++++++++++++++----- 2 files changed, 73 insertions(+), 20 deletions(-) (limited to 'vcl/win/window') 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(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; -- cgit v1.2.3