< prev index next >

modules/javafx.graphics/src/main/native-glass/gtk/GlassApplication.cpp

Print this page
rev 10015 : 8137141: Fatal error in Method::build_method_counters when called from libglass.so

*** 54,67 **** static gboolean call_runnable (gpointer data) { RunnableContext* context = reinterpret_cast<RunnableContext*>(data); ! mainEnv->CallVoidMethod(context->runnable, jRunnableRun, NULL); ! LOG_EXCEPTION(mainEnv); ! mainEnv->DeleteGlobalRef(context->runnable); free(context); return FALSE; } extern "C" { --- 54,78 ---- static gboolean call_runnable (gpointer data) { RunnableContext* context = reinterpret_cast<RunnableContext*>(data); ! JNIEnv *env; ! int envStatus = javaVM->GetEnv((void **)&env, JNI_VERSION_1_6); ! if (envStatus == JNI_EDETACHED) { ! javaVM->AttachCurrentThread((void **)&env, NULL); ! } ! ! env->CallVoidMethod(context->runnable, jRunnableRun, NULL); ! LOG_EXCEPTION(env); ! env->DeleteGlobalRef(context->runnable); free(context); + + if (envStatus == JNI_EDETACHED) { + javaVM->DetachCurrentThread(); + } + return FALSE; } extern "C" {
< prev index next >