United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4862593 : JVM crash when dragging from Java UI component to natively rendered window/peer

Details
Type:
Bug
Submit Date:
2003-05-12
Status:
Resolved
Updated Date:
2004-09-16
Project Name:
JDK
Resolved Date:
2003-08-07
Component:
client-libs
OS:
solaris_9
Sub-Component:
java.awt
CPU:
sparc
Priority:
P1
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.2_02 (02)

Related Reports
Backport:
Relates:

Sub Tasks

Description
An ISV uses the techniques outlined in http://java.sun.com/j2se/1.3/docs/guide/awt/AWT_Native_Interface.html for rendering to a Java window via Native Code.  The native code rendering is OpenGL-based, and JNI is used for Java - native integration.

When the mouse is dragged from a Java UI component (e.g., Swing, AWT) to the native window with native code rendering, the JVM crashes immediately in 1.4.x (1.4.1_01-b01, 1.4.1_02-b06, 1.4.2-beta-b19).  Note that the problem does not occur in 1.3.1_07/_08.

The problem has variously been present (and fixed/absent) since 1.2.x.

This problem was first reported in bug id #4413973, and the fix incorporated for that bug was reportedly included in the 1.4.x tree; however that fix does not address this problem.

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_02
tiger

FIXED IN:
1.4.2_02
tiger

INTEGRATED IN:
1.4.2_02
tiger
tiger-b15


                                     
2004-09-17
EVALUATION

Commit to fix in Tiger.  
###@###.### 2003-05-12

The problem is due to an invalid object is being passed to awt_post_java_mouse_event() and subsequently crashes in jni_GetObjectClass.
I've attached a native stack trace with line numbers corresponding to 1.4.1_04 in the attachment (native.txt). 
The fix is to check if the current widget is of AWT type.
The cause for this bug is that the fix for 4413973 wasn't forward ported correctly from 1.2.2/1.3 to 1.4/1.4.1/1.4.2.
###@###.### 2003-07-09
                                     
2003-07-09
SUGGESTED FIX

--- canvas.c    Thu Jul  3 09:25:16 2003


*** 1,7 ****
  /*
!  * @(#)canvas.c       1.212 03/04/25
   *
   * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
   * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   */
  
--- 1,7 ----
  /*
!  * @(#)canvas.c       1.213 03/07/03
   *
   * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
   * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
   */
  


*** 1935,1945 ****
                            java_awt_event_MouseEvent_NOBUTTON);
                      }
                  }
   
                  if ((currentWidget != NULL) && (currentWidget != w) && 
!                     (currentWidget != prevWidget) && awt_isAwtWidget(prevWidget)) {
                      XtPointer userData=NULL;
                      XtVaGetValues(currentWidget, XmNuserData, &userData, NULL);
                      if (userData) {                   
                        awt_post_java_mouse_event(userData,
                            java_awt_event_MouseEvent_MOUSE_ENTERED,
--- 1935,1945 ----
                            java_awt_event_MouseEvent_NOBUTTON);
                      }
                  }
   
                  if ((currentWidget != NULL) && (currentWidget != w) && 
!                     (currentWidget != prevWidget) && awt_isAwtWidget(currentWidget)) {
                      XtPointer userData=NULL;
                      XtVaGetValues(currentWidget, XmNuserData, &userData, NULL);
                      if (userData) {                   
                        awt_post_java_mouse_event(userData,
                            java_awt_event_MouseEvent_MOUSE_ENTERED,

###@###.### 2003-07-09
                                     
2003-07-09



Hardware and Software, Engineered to Work Together