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: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aric Stewart 2016-02-12 09:31:11 -06:00 committed by Alexandre Julliard
parent f253e6cf93
commit e7f725ec5f
1 changed files with 14 additions and 6 deletions

View File

@ -2893,15 +2893,23 @@ BOOL WINAPI ImmGenerateMessage(HIMC hIMC)
if (data->IMC.dwNumMsgBuf > 0) if (data->IMC.dwNumMsgBuf > 0)
{ {
LPTRANSMSG lpTransMsg; LPTRANSMSG lpTransMsg;
DWORD i; HIMCC hMsgBuf;
DWORD i, dwNumMsgBuf;
lpTransMsg = ImmLockIMCC(data->IMC.hMsgBuf); /* We are going to detach our hMsgBuff so that if processing messages
for (i = 0; i < data->IMC.dwNumMsgBuf; i++) 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); ImmInternalSendIMEMessage(data, lpTransMsg[i].message, lpTransMsg[i].wParam, lpTransMsg[i].lParam);
ImmUnlockIMCC(data->IMC.hMsgBuf); ImmUnlockIMCC(hMsgBuf);
ImmDestroyIMCC(hMsgBuf);
data->IMC.dwNumMsgBuf = 0;
} }
return TRUE; return TRUE;