JDK-6542975 : Crash in awt.dll when WM_IME_NOTIFY message is handled, Win32
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows,windows_xp
  • CPU: x86
  • Submitted: 2007-04-05
  • Updated: 2012-03-22
  • Resolved: 2009-05-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u10Fixed 7 b55Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
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.

EVALUATION The fix has been integrated as a part of the fix for 6806217.

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

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.

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

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.