JDK-4413973 : Java Crash When Dragging Into Native Widget
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.2.2_07
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2001-02-09
  • Updated: 2001-10-19
  • Resolved: 2001-06-19
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 Other
1.2.2_009 009Fixed 1.2.2_09Fixed 1.3.0_04Fixed 1.3.1_01Fixed 1.4.0Fixed
Related Reports
Relates :  
Description
One of my ISVs ships a bean that includes a Canvas, and a native 3D model viewer 
widget that lays on top of the Canvas.  They use JNI to communicate with their 
native viewer.  When they place this bean in a variety of Java components 
(including Frame, JFrame, JPanel, or JSplitPane) and drag the mouse from the 
Java component into the native window, the app crashes.  

See the "comments" section of this bug report for stack traces from gdb and from the ISV's app, and for instructions on how to reproduce the bug.  

When the crash was first noticed, the Java component was not a mouse event listener.  The ISV tried  to trap/handle the problem by making the component into a listener, but had no luck.  

The ISV reported this crash on Solaris 8 using Java Version 1.2.2.05a.

I saw the crash on Solaris 8 using:
Solaris_JDK_1.2.2_05a
Solaris_JDK_1.2.2_06
Solaris_JDK_1.2.2_07

I can't make the crash occur on Solaris_JDK_1.2.1_04c; the app seems to run fine 
on this JDK.  

On JDK 1.3.0 the app crashes as soon as it starts with the following error; this 
prevents me from dragging the mouse from the frame into the native widget to 
reproduce the bug reported by the ISV. 

# # An unexpected exception has been detected in native code outside the VM.# 
Program counter=0xf3fe4ccc
#
# Problematic Thread: prio=6 tid=0x4f0200 nid=0xd runnable 
#
Abort


Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.2.2_009 1.2.2_09 merlin-beta2 FIXED IN: 1.2.2_009 1.2.2_09 merlin-beta2 INTEGRATED IN: 1.2.2_009 1.2.2_09 1.3.0_04 1.3.1_01 merlin-beta2 VERIFIED IN: 1.2.2_009 1.2.2_09 1.3.0_04 1.3.1_01a
14-06-2004

EVALUATION for production 1.2.2: this seems to be caused by user use native code to create a non java widget inside a java widget, see suggested fix for detail. tao.ma@Eng 2001-02-23 I put this fix into merlin-beta2 (should be in build 69). eric.hawkes@eng 2001-06-18
23-02-2001

SUGGESTED FIX diff for production 1.2.2_07 check for whether the widget is java before using its XmNuserData as a jobject ------- awt_p.h ------- *** /tmp/dB9aGPY Fri Feb 23 14:26:29 2001 --- awt_p.h Fri Feb 23 13:55:16 2001 *************** *** 293,298 **** --- 293,299 ---- extern void awt_delWidget(Widget w); extern void awt_enableWidgetEvents(Widget w, long event_mask); extern void awt_disableWidgetEvents(Widget w, long event_mask); + extern int awt_isAwtWidget(Widget widget); extern int awt_allocate_colors(AwtData *); extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtData *); ------- awt_MToolkit.c ------- *** /tmp/dQyaiOY Fri Feb 23 14:24:11 2001 --- awt_MToolkit.c Fri Feb 23 13:57:46 2001 *************** *** 469,474 **** --- 469,482 ---- return NULL; } + int awt_isAwtWidget(Widget widget) + { + if (findWidgetInfo(widget)) + return 1; + else + return 0; + } + static void * findPeer(Widget * pwidget) { ------- canvas.c ------- *** /tmp/diqaiPY Fri Feb 23 14:25:45 2001 --- canvas.c Fri Feb 23 14:04:29 2001 *************** *** 1217,1223 **** XtTranslateCoords(w, x, y, &wx, &wy); currentWidget = awt_WidgetAtXY(topLevel, wx, wy); ! if(prevWidget && prevWidget!=w && currentWidget!=prevWidget) { XtPointer userData=0; XtVaGetValues(prevWidget, XmNuserData, &userData, NULL); if (userData) { --- 1217,1224 ---- XtTranslateCoords(w, x, y, &wx, &wy); currentWidget = awt_WidgetAtXY(topLevel, wx, wy); ! if(prevWidget && prevWidget!=w && currentWidget!=prevWidget ! && awt_isAwtWidget(prevWidget)) { XtPointer userData=0; XtVaGetValues(prevWidget, XmNuserData, &userData, NULL); if (userData) { *************** *** 1232,1238 **** } } ! if(currentWidget&& currentWidget!=w && currentWidget!=prevWidget) { XtPointer userData=0; XtVaGetValues(currentWidget, XmNuserData, &userData, NULL); if (userData) { --- 1233,1240 ---- } } ! if(currentWidget&& currentWidget!=w && currentWidget!=prevWidget ! && awt_isAwtWidget(currentWidget)) { XtPointer userData=0; XtVaGetValues(currentWidget, XmNuserData, &userData, NULL); if (userData) { *************** *** 1975,1980 **** --- 1977,1983 ---- (*env)->SetLongField(env, hEvent, awtEventIDs.data, (jlong) eventdata); + JNU_PrintClass(env, "peer class: ", peer); JNU_CallMethodByName(env, NULL, peer, "postEvent", "(Ljava/awt/AWTEvent;)V", hEvent); if ((*env)->ExceptionOccurred(env)) { tao.ma@Eng 2001-02-23
23-02-2001