United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6542975 Crash in awt.dll when WM_IME_NOTIFY message is handled, Win32
JDK-6542975 : Crash in awt.dll when WM_IME_NOTIFY message is handled, Win32

Details
Type:
Bug
Submit Date:
2007-04-05
Status:
Resolved
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2009-05-07
Component:
client-libs
OS:
windows_xp,windows
Sub-Component:
java.awt
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:
Duplicate:
Duplicate:
Relates:
Relates:
Relates:

Sub Tasks

Description
Run the attached test. It shows two frames and a window with a button. One of the frames (the right one) is a parent for the window. Press the button, so the window gets focused, and then press the title of the left frame. If you see JVM has crashed, the bug is reproduced.

The bug can only be reproduced with 7.0-b02 or later. I suspect this is the fix for 6359035 that has some impact on this problem. That fix contained the code which changes the way how AWT native components are subclassed.

                                    

Comments
EVALUATION

Some investigation showed that the crash happens when we call DefWindowProc for a message WM_IME_NOTIFY, from AwtFrame::ProxyWindowProc (~awt_Frame.cpp:331 in my workspace). From the attached HotSpot log file, I roughly see, what's going. When I press the title of the left frame, we call WInputMethod.enableNativeIME(), then send a message WM_AWT_ASSOSIATECONTEXT to the toolkit thread, then call AwtComponent::ImmAssosiateContext() and call the native ::ImmAssosiateContext(). This leads to the message WM_IME_SETCONTEXT which is unhandled and forwarded to DefWindowProc, and then WM_IME_NOTIFY, also forwarder to DefWindowProc.
                                     
2007-04-05
EVALUATION

Undoing the changes made in awt_Component.cpp for 6359035 stopped the crashing. 
Reassigning this CR to awt team. 
Thanks.
                                     
2007-04-05
EVALUATION

As I can see. WM_IME_NOTIFY comes to the proxy at the moment when I click
to the second frame (not the owner). The messages contains wParam equal to
IMN_CLOSESTATUSWINDOW. The component corresponding to the current sm_focusOwner
value is retrived and the message is forwarded to its WindowProc.
The problem is that by this time the sm_focusOwner has already been reset to
the new focused component (in the second frame I had clicked).

To solve the problem we can retain the most recent focused component
proxied by the proxy. And then forward IME messages to it appropriately.
                                     
2007-05-04
EVALUATION

The fix is going to be integrated in jdk7 as a part of the fwd-ported 6693253.
                                     
2009-03-02
EVALUATION

The fix has been integrated as a part of the fix for 6806217.
                                     
2009-03-11



Hardware and Software, Engineered to Work Together