United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6212440 IE crash on shutdown in the applet using DnD
JDK-6212440 : IE crash on shutdown in the applet using DnD

Details
Type:
Bug
Submit Date:
2004-12-24
Status:
Resolved
Updated Date:
2006-04-06
Project Name:
JDK
Resolved Date:
2005-07-23
Component:
client-libs
OS:
windows_2000
Sub-Component:
java.awt
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.2_06
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

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
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
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



Hardware and Software, Engineered to Work Together