diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/win/dtrans/MtaOleClipb.cxx | 23 | ||||
-rw-r--r-- | vcl/win/dtrans/target.cxx | 10 |
2 files changed, 25 insertions, 8 deletions
diff --git a/vcl/win/dtrans/MtaOleClipb.cxx b/vcl/win/dtrans/MtaOleClipb.cxx index 6fc789e27d9d..f6e471925516 100644 --- a/vcl/win/dtrans/MtaOleClipb.cxx +++ b/vcl/win/dtrans/MtaOleClipb.cxx @@ -45,6 +45,8 @@ #include <systools/win32/comtools.hxx> +#include <comphelper/windowserrorstring.hxx> + // namespace directives using osl::MutexGuard; @@ -642,22 +644,29 @@ unsigned int CMtaOleClipboard::run( ) createMtaOleReqWnd( ); - unsigned int nRet; + unsigned int nRet = ~0U; // = error if ( IsWindow( m_hwndMtaOleReqWnd ) ) { if ( nullptr != m_hEvtThrdReady ) SetEvent( m_hEvtThrdReady ); + nRet = 0; + // pumping messages MSG msg; - while( GetMessageW( &msg, nullptr, 0, 0 ) ) - DispatchMessageW( &msg ); - - nRet = 0; + BOOL bRet; + while ((bRet = GetMessageW(&msg, nullptr, 0, 0)) != 0) + { + if (-1 == bRet) + { + SAL_WARN("vcl.win.dtrans", "GetMessageW failed: " << WindowsErrorString(GetLastError())); + nRet = ~0U; + break; + } + DispatchMessageW(&msg); + } } - else - nRet = ~0U; OleUninitialize( ); diff --git a/vcl/win/dtrans/target.cxx b/vcl/win/dtrans/target.cxx index adddabab7038..45a8515bd414 100644 --- a/vcl/win/dtrans/target.cxx +++ b/vcl/win/dtrans/target.cxx @@ -30,6 +30,8 @@ #include "targetdragcontext.hxx" #include <rtl/ustring.h> #include <osl/thread.h> +#include <sal/log.hxx> +#include <comphelper/windowserrorstring.hxx> #include "DOTransferable.hxx" @@ -206,8 +208,14 @@ DWORD WINAPI DndTargetOleSTAFunc(LPVOID pParams) DWORD threadId= GetCurrentThreadId(); // We force the creation of a thread message queue. This is necessary // for a later call to AttachThreadInput - while( GetMessageW(&msg, nullptr, 0, 0) ) + BOOL bRet; + while ((bRet = GetMessageW(&msg, nullptr, 0, 0)) != 0) { + if (-1 == bRet) + { + SAL_WARN("vcl.win.dtrans", "GetMessageW failed: " << WindowsErrorString(GetLastError())); + break; + } if( msg.message == WM_REGISTERDRAGDROP) { DropTarget *pTarget= reinterpret_cast<DropTarget*>(msg.wParam); |