JDK-6212440 : IE crash on shutdown in the applet using DnD
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2_06
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-12-24
  • Updated: 2006-04-06
  • Resolved: 2005-07-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 JDK 6
1.4.2_09Fixed 6 b45Fixed
Description
IE always crash on applet exit when JNI code is called from anywhere in the application. ie; whenever JNI calls are made, from whichever place, the IE 
will crash on exit. 

The entire application was working fine using JCOM calls with the MSJVM.The only new code added since then is the JNI wrapper class in the C++ code, and the corresponding wrapper in the Java Code.

The problem is reproducible with JDK 1.5.0 Update 1 also.
###@###.### 2004-12-24 05:42:18 GMT

Comments
SUGGESTED FIX ------- awt_DnDDS.cpp ------- *** - Sun Jul 10 22:09:20 2005 --- awt_DnDDS.cpp Sun Jul 10 22:08:28 2005 *************** *** 166,175 **** AwtDragSource::~AwtDragSource() { JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); ! env->DeleteGlobalRef(m_peer); ! env->DeleteGlobalRef(m_component); ! env->DeleteGlobalRef(m_transferable); ! env->DeleteGlobalRef(m_formatMap); ::CloseHandle(m_mutex); --- 166,181 ---- AwtDragSource::~AwtDragSource() { JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); ! // fix for 6212440: on application shutdown, this object's ! // destruction might be suppressed due to dangling COM references. ! // On destruction, VM might be shut down already, so we should make ! // a null check on env. ! if (env) { ! env->DeleteGlobalRef(m_peer); ! env->DeleteGlobalRef(m_component); ! env->DeleteGlobalRef(m_transferable); ! env->DeleteGlobalRef(m_formatMap); ! } ::CloseHandle(m_mutex); ------- awt_DnDDT.cpp ------- *** - Sun Jul 10 22:10:04 2005 --- awt_DnDDT.cpp Sun Jul 10 22:08:27 2005 *************** *** 60,67 **** AwtDropTarget::~AwtDropTarget() { JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); ! env->DeleteGlobalRef(m_target); ! env->DeleteGlobalRef(m_dtcp); ::CloseHandle(m_mutex); --- 60,73 ---- AwtDropTarget::~AwtDropTarget() { JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); ! // fix for 6212440: on application shutdown, this object's ! // destruction might be suppressed due to dangling COM references. ! // On destruction, VM might be shut down already, so we should make ! // a null check on env. ! if (env) { ! env->DeleteGlobalRef(m_target); ! env->DeleteGlobalRef(m_dtcp); ! } ::CloseHandle(m_mutex); *************** *** 857,863 **** m_formats = (FORMATETC *)NULL; m_nformats = 0; ! env->DeleteGlobalRef(m_cfFormats); m_cfFormats = NULL; if (!IsLocalDnD()) { --- 863,876 ---- m_formats = (FORMATETC *)NULL; m_nformats = 0; ! // fix for 6212440: on application shutdown, this object's ! // destruction might be suppressed due to dangling COM references. ! // This method is called from the destructor. ! // On destruction, VM might be shut down already, so we should make ! // a null check on env. ! if (env) { ! env->DeleteGlobalRef(m_cfFormats); ! } m_cfFormats = NULL; if (!IsLocalDnD()) { ###@###.### 2005-07-10 18:11:35 GMT
2005-01-31

EVALUATION Unable to reproduce using suggested source code since it's not complete. It would very useful to know more about the crash Java_sun_awt_Win32GraphicsConfig_getBounds(). Might be useful to look into log generated by IE. I've looked through the bugs and found something that might cause this crash - 4947550. Not sure that this is correct one. Asking submitter for more info. ###@###.### 2005-1-20 15:40:55 GMT The crash happens on AwtDropTarget destruction which happens _after_ toolkit disposal due to a dangling COM reference. Suggested fix is considering the destructor an entry point and checking if the toolkit is still active. ###@###.### 2005-1-31 17:23:32 GMT
2005-01-20