From a283b986c768d386b4e0937632059f61e0a256be Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 12 Dec 2012 14:06:46 +0100 Subject: [PATCH] ole32: Limit the number of messages processed at once in CoWaitForMultipleObjects. --- dlls/ole32/compobj.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index af5b0fe1e9a..460ed4ec976 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3871,6 +3871,7 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, if (res == WAIT_OBJECT_0 + cHandles) /* messages available */ { MSG msg; + int count = 0; /* call message filter */ @@ -3900,7 +3901,9 @@ HRESULT WINAPI CoWaitForMultipleHandles(DWORD dwFlags, DWORD dwTimeout, } } - while (COM_PeekMessage(apt, &msg)) + /* some apps (e.g. Visio 2010) don't handle WM_PAINT properly and loop forever, + * so after processing 100 messages we go back to checking the wait handles */ + while (count++ < 100 && COM_PeekMessage(apt, &msg)) { TRACE("received message whilst waiting for RPC: 0x%04x\n", msg.message); TranslateMessage(&msg);