JDK-5093198 : XAWT: Java crashes on window dispose/getLocationOnScreen
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_redhat_2.1,solaris_9
  • CPU: generic,x86
  • Submitted: 2004-08-27
  • Updated: 2012-10-09
  • Resolved: 2004-09-28
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 JDK 6
5.0u1 01Fixed 6Fixed
Related Reports
Duplicate :  
Relates :  
Description
If getLocationOnScreen is being performed on the window which is being disposed of, Java sometimes crashes. Happens with XToolkit, 1.5.0 b63. Stack trace:
# C  [libX11.so.6+0x2ec76]  XScreenNumberOfScreen+0x6

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libX11.so.6+0x2ec76]  XScreenNumberOfScreen+0x6
j  sun.awt.X11.XlibWrapper.XScreenNumberOfScreen(J)J+0
j  sun.awt.X11.XBaseWindow.getScreenNumber()J+10
j  sun.awt.X11.XBaseWindow.toGlobal(II)Ljava/awt/Point;+11
j  sun.awt.X11.XWindow.getLocationOnScreen()Ljava/awt/Point;+48
j  java.awt.Component.getLocationOnScreen_NoTreeLock()Ljava/awt/Point;+86
j  java.awt.Component.getLocationOnScreen()Ljava/awt/Point;+8
###@###.### 2004-08-27
###@###.### 2004-08-27

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.5.0_01 mustang FIXED IN: 1.5.0_01 mustang INTEGRATED IN: 1.5.0_01
29-09-2004

EVALUATION XlibWrapper.c:..._XGetWindowAttributes and _getScreenOfWindow functions don't clear memory of XWindowAttributes structure, and also don't check for return value. If X window is disposed of, the function will not initialize the structure and will leave pointers inside of it(Screen) not initialize. When we access it, we crash. ###@###.### 2004-08-27 The fix for 5063031 (setBoundsPrivate doesn't function properly) contains memory cleanup lines in XlibWrapper.c, so fixes this bug too Should try to fix this in update release. ###@###.### 2004-08-30 ###@###.### 2004-08-29 ###@###.### 2004-09-03
30-08-2004

SUGGESTED FIX *** /tmp/geta11751.P11754 2004-08-27 17:44:36.546107912 +0400 --- XlibWrapper.c 2004-08-27 17:44:35.632246840 +0400 *************** *** 949,954 **** --- 949,955 ---- (JNIEnv *env, jclass clazz, jlong display, jlong window) { XWindowAttributes attrs; + memset(&attrs, 0, sizeof(attrs)); AWT_CHECK_HAVE_LOCK(); XGetWindowAttributes((Display*)display, window, &attrs); return (jlong)attrs.screen; ###@###.### 2004-08-27
27-08-2004