SUGGESTED FIX
--- awt_Window.cpp 2008-01-11 20:06:20.000000000 +0300
***************
*** 2143,2149 ****
{
TRY;
! AwtWindow::wwindowPeerCls = cls;
AwtWindow::getActiveWindowsMID =
env->GetStaticMethodID(cls, "getActiveWindowHandles", "()[J");
DASSERT(AwtWindow::getActiveWindowsMID != NULL);
--- 2143,2149 ----
{
TRY;
! AwtWindow::wwindowPeerCls = (jclass)env->NewGlobalRef(cls);
AwtWindow::getActiveWindowsMID =
env->GetStaticMethodID(cls, "getActiveWindowHandles", "()[J");
DASSERT(AwtWindow::getActiveWindowsMID != NULL);
|
EVALUATION
I tracked the crash up to the place where we get the array of active windows in AwtDialog:
void AwtDialog::ModalActivateNextWindow(HWND dialogHWnd,
jobject dialogTarget, jobject dialogPeer){
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jlongArray windows = (jlongArray)(env->CallStaticObjectMethod(AwtWindow::wwindowPeerCls, awtWindow::getActiveWindowsMID));
Seem that the AwtWindow::wwindowPeerCls member has Local instead of Global reference as its value. Searching the place where the assignment happens I found:
Java_sun_awt_windows_WWindowPeer_initIDs(JNIEnv *env, jclass cls)
{
TRY;
AwtWindow::wwindowPeerCls = cls;
AwtWindow::getActiveWindowsMID =...
Should wrap it into GlobalRef before using from the other thread.
Perhaps the change caused that code to be called on a different thread and caused this to happen went into early JDK7 build.
|