[Bug 31157] Filemaker Pro 12 Trial crashes when opening a sample solution ('ImmAssociateContext' should only generate 'WM_IME_SETCONTEXT' if window has focus)
wine-bugs at winehq.org
wine-bugs at winehq.org
Sun Jul 20 16:07:11 CDT 2014
https://bugs.winehq.org/show_bug.cgi?id=31157
Anastasius Focht <focht at gmx.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|-unknown |imm32
Summary|Filemaker Pro 12 Trial |Filemaker Pro 12 Trial
|crashes when opening a |crashes when opening a
|sample solution |sample solution
| |('ImmAssociateContext'
| |should only generate
| |'WM_IME_SETCONTEXT' if
| |window has focus)
--- Comment #7 from Anastasius Focht <focht at gmx.net> ---
Hello folks,
it seems the app's message handler doesn't like/expect 'WM_IME_SETCONTEXT'
message during 'ImmAssociateContext' hence crash in some nested app code.
MSDN: http://msdn.microsoft.com/en-us/library/cc194857.aspx
--- quote ---
To create an input context, call ImmCreateContext. To associate this context
with a window, call ImmAssociateContext. After you have associated an input
context with a window, the system will automatically provide the input context
whenever the window gets the focus. The system generates a WM_IME_SETCONTEXT
message; the input context is contained in the lParam. If you make changes to
the input context, you should call ImmNotifyIME so that the IME can remain
synchronized. To destroy the custom input context before you terminate your
application, you must call ImmDestroyContext.
--- quote ---
The key here is: who has the focus.
The window doesn't have the focus at the point of associating the context hence
it doesn't seem correct to unconditionally send 'WM_IME_SETCONTEXT' message.
Source:
http://source.winehq.org/git/wine.git/blob/f0de67de0cab3e67364d699850d86325ddcf70f7:/dlls/imm32/imm.c#l475
--- snip ---
475 HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC)
476 {
...
519 if (!hIMC)
520 return old;
521
522 if (IsWindow(data->IMC.hWnd))
523 {
524 /*
525 * Post a message that your context is switching
526 */
527 SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, FALSE,
ISC_SHOWUIALL);
528 }
529
530 data->IMC.hWnd = hWnd;
531
532 if (IsWindow(data->IMC.hWnd))
533 {
534 /*
535 * Post a message that your context is switching
536 */
537 SendMessageW(data->IMC.hWnd, WM_IME_SETCONTEXT, TRUE,
ISC_SHOWUIALL);
538 }
539
540 return old;
541 }
--- snip ---
I modified the code to only send 'WM_IME_SETCONTEXT' if focused window == hWnd
and it helped.
The app doesn't crash and all templates/examples are loaded successfully.
Regards
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list