JDK-6668385 : Java applet crashes IE 6 in AwtComponent::ImmAssociateContext()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0u14,5.0u15,6u4
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-02-27
  • Updated: 2010-12-09
  • Resolved: 2009-03-23
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.
Other Other Other Other JDK 6
5.0u16-crevFixed 5.0u17-crevFixed 5.0u18-rev b04Fixed 5.0u19Fixed 6-poolResolved
Related Reports
Relates :  
Relates :  
Description
Java applet crashes IE 6 (Windows XP SP2) when running on 1.5.0_14.
The problem is not reproducible on 1.5.0_13.

The problem is very well reproducible, although not strictly, both on
single and dual processor machines.

1. Test case
------------
Please run attached test case AHS.zip on 1.5.0_14:

- uncompress AHS.zip
- cd AHS
- open StartaAHS.html in IE
  1. click on the link to start AHS.
     a separate window will open. 
     it shows a single tab named "��rendeinfo"
  2. close windows after initiated
- Repeat steps 1+2 until IE will crash (10 - 15 iterations most likely are enough)


2. hs_err_pid.log
-----------------
Hotspot error log reproducibly shows a crash in [awt.dll+0xc86bc]:
(see attached hs_err_pid3576.log)

Stack: [0x051b0000,0x052b0000),  sp=0x052af9b4,  free space=1022k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [awt.dll+0xc86bc]
C  [USER32.dll+0x8709]
C  [USER32.dll+0x87eb]
C  [USER32.dll+0xb368]
C  [USER32.dll+0xb3b4]
C  [ntdll.dll+0xeae3]
C  [USER32.dll+0x93df]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.awt.windows.WToolkit.eventLoop()V+0
j  sun.awt.windows.WToolkit.run()V+69
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub


3. awt function
---------------
[awt.dll+0xc86bc] translates into

0:000> ln awt+0xc86bc
(6d0c86b0)   awt!AwtComponent::ImmAssociateContext+0xc

Comments
SUGGESTED FIX ------- awt_Component.cpp ------- *** /tmp/sccs.bIElO9 2009-02-05 12:04:03.000000000 +0300 --- awt_Component.cpp 2009-02-05 12:10:49.309350000 +0300 *************** *** 2167,2172 **** --- 2167,2176 ---- sm_focusedWindow = GetTopLevelParentForWindow(GetHWnd()); ::SendMessage(hwnd, WM_SETFOCUS, (WPARAM)oldFocusOwner, 0); + + if (sm_focusOwner == hwnd) { + owner->SetLastProxiedFocusOwner(sm_focusOwner); + } } return TRUE; *************** *** 4463,4470 **** HIMC AwtComponent::ImmAssociateContext(HIMC himc) { ! HWND proxy = GetProxyFocusOwner(); ! return ::ImmAssociateContext((proxy != NULL) ? proxy : GetHWnd(), himc); } HWND AwtComponent::GetProxyFocusOwner() --- 4467,4486 ---- HIMC AwtComponent::ImmAssociateContext(HIMC himc) { ! HWND proxy = (HWND)NULL; ! AwtWindow * window = GetContainer(); ! ! if (window != 0) { ! AwtFrame * owner = window->GetOwningFrameOrDialog(); ! if (owner != 0) { ! proxy = owner->GetLastProxiedFocusOwner(); ! } ! }else{ ! return 0; ! } ! ! HIMC myhimc = ::ImmAssociateContext((proxy != NULL) ? proxy : GetHWnd(), himc); ! return myhimc; } HWND AwtComponent::GetProxyFocusOwner() ------- awt_Frame.h ------- *** /tmp/sccs.NcuHXZ 2009-02-05 12:04:03.000000000 +0300 --- awt_Frame.h 2008-11-12 14:40:28.414340000 +0300 *************** *** 98,103 **** --- 98,106 ---- return m_proxyFocusOwner; } + INLINE HWND GetLastProxiedFocusOwner() { return m_lastProxiedFocusOwner; } + INLINE void SetLastProxiedFocusOwner(HWND hwnd) { m_lastProxiedFocusOwner = hwnd; } + void SetMaximizedBounds(int x, int y, int w, int h); void ClearMaximizedBounds(); *************** *** 159,164 **** --- 162,171 ---- or an AwtDialog (or one of its children) has the logical input focus. */ HWND m_proxyFocusOwner; + /* Retains the last/current sm_focusOwner proxied. Actually, it should be + * a component of an owned window last/currently active. */ + HWND m_lastProxiedFocusOwner; + /* * Fix for 4823903. * Retains a focus proxied window to set the focus correctly ------- awt_Frame.cpp ------- *** /tmp/sccs.9TvZbQ 2009-02-05 12:04:03.000000000 +0300 --- awt_Frame.cpp 2008-11-12 14:46:04.163862000 +0300 *************** *** 83,88 **** --- 83,89 ---- m_windowClassName = NULL; m_isUndecorated = FALSE; m_proxyFocusOwner = NULL; + m_lastProxiedFocusOwner = NULL; m_actualFocusedWindow = NULL; m_iconic = FALSE; m_zoomed = FALSE; *************** *** 334,340 **** case WM_IME_KEYUP: case WM_INPUTLANGCHANGEREQUEST: case WM_INPUTLANGCHANGE: ! AwtComponent *p = AwtComponent::GetComponent(sm_focusOwner); if (p!= NULL) { return p->WindowProc(message, wParam, lParam); } --- 335,341 ---- case WM_IME_KEYUP: case WM_INPUTLANGCHANGEREQUEST: case WM_INPUTLANGCHANGE: ! AwtComponent *p = AwtComponent::GetComponent(parent->GetLastProxiedFocusOwner()); if (p!= NULL) { return p->WindowProc(message, wParam, lParam); }
04-03-2009

EVALUATION The parent associated should be a component of an owned window last / currently active instead of the the last/current proxied.
04-03-2009

WORK AROUND use 1.5.0_13
27-02-2008