diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-01-28 08:43:12 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2021-01-28 17:08:47 +0100 |
commit | d249bd5a3dfe13052ce9aa91bad94ec7d60604d4 (patch) | |
tree | bac7543b6d1f7c85ae449c10d2d6f7ab78ea9180 /vcl/win/dtrans/target.cxx | |
parent | 33656a6c7500d0f799b0e4ed97bda0a9e58a7010 (diff) |
WIN handle GetMessageW return values
GetMessageW returns a BOOL with three defined return values; a
bit unexpected (-1 = error, 0 = WM_QUIT, * = dispatch message).
So this tries to handle the non-dispatch results in some way.
It's not clear for me, if there is some sensible way to "recover"
from an error, but from all I've read it doesn't look like it.
"Recover" means in this case, that the last call failed but next
call may still succeed without changing the parameters.
Change-Id: Ib1f366c7ce8b48158d1935938b49d8da991b30e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110043
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/win/dtrans/target.cxx')
-rw-r--r-- | vcl/win/dtrans/target.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
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); |