7045174: Most of the tests in awt area fails with jdk 7b142 on windows with -Xcheck:jni

Reviewed-by: art, denis
This commit is contained in:
Oleg Pekhovskiy 2011-05-27 11:45:08 +04:00
parent 7f5de78e6f
commit df0aefd4ae
2 changed files with 7 additions and 2 deletions

View File

@ -69,9 +69,12 @@ void AwtObject::_Dispose(jobject self)
CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS());
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jobject selfGlobalRef = env->NewGlobalRef(self);
// value 0 of lParam means that we should not attempt to enter the
// SyncCall critical section, as it was entered someshere earlier
AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)self, (LPARAM)0);
AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)selfGlobalRef, (LPARAM)0);
CATCH_BAD_ALLOC;
}

View File

@ -741,7 +741,9 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
}
if (canDispose) {
if(wParam != NULL) {
AwtObject *o = (AwtObject *) JNI_GET_PDATA((jobject)wParam);
jobject self = (jobject)wParam;
AwtObject *o = (AwtObject *) JNI_GET_PDATA(self);
env->DeleteGlobalRef(self);
if(o != NULL && theAwtObjectList.Remove(o)) {
o->Dispose();
}