Commit e7f725ec authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

imm32: Detach hMsgBuf when sending messages in ImmGenerateMessage.

The issues is that if a message being sent in ImmGenerateMessage gets turned around and sent into an IME that in response to that message calls ImmGenerateMessage, the hMsgBuf still has the old message in it and it ends up getting processed in a loop again and again. Signed-off-by: 's avatarAric Stewart <aric@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f253e6cf
......@@ -2893,15 +2893,23 @@ BOOL WINAPI ImmGenerateMessage(HIMC hIMC)
if (data->IMC.dwNumMsgBuf > 0)
{
LPTRANSMSG lpTransMsg;
DWORD i;
HIMCC hMsgBuf;
DWORD i, dwNumMsgBuf;
lpTransMsg = ImmLockIMCC(data->IMC.hMsgBuf);
for (i = 0; i < data->IMC.dwNumMsgBuf; i++)
ImmInternalSendIMEMessage(data, lpTransMsg[i].message, lpTransMsg[i].wParam, lpTransMsg[i].lParam);
ImmUnlockIMCC(data->IMC.hMsgBuf);
/* We are going to detach our hMsgBuff so that if processing messages
generates new messages they go into a new buffer */
hMsgBuf = data->IMC.hMsgBuf;
dwNumMsgBuf = data->IMC.dwNumMsgBuf;
data->IMC.hMsgBuf = ImmCreateIMCC(0);
data->IMC.dwNumMsgBuf = 0;
lpTransMsg = ImmLockIMCC(hMsgBuf);
for (i = 0; i < dwNumMsgBuf; i++)
ImmInternalSendIMEMessage(data, lpTransMsg[i].message, lpTransMsg[i].wParam, lpTransMsg[i].lParam);
ImmUnlockIMCC(hMsgBuf);
ImmDestroyIMCC(hMsgBuf);
}
return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment