When finalizing the prototype objects, don't try to access the JNIEnv, since that can cause the JVM to be unnecessarily loaded

This commit is contained in:
fur%netscape.com 1998-09-23 18:36:38 +00:00
parent 3bd6604844
commit a3c65849c2
2 changed files with 8 additions and 7 deletions

View File

@ -64,13 +64,14 @@ JavaMember_finalize(JSContext *cx, JSObject *obj)
JavaMethodOrFieldValue *member_val;
JNIEnv *jEnv;
member_val = JS_GetPrivate(cx, obj);
if (!member_val)
return;
jsj_MapJSContextToJSJThread(cx, &jEnv);
if (!jEnv)
return;
member_val = JS_GetPrivate(cx, obj);
if (!member_val)
return;
JS_RemoveRoot(cx, &member_val->method_val);
if (JSVAL_IS_GCTHING(member_val->method_val))
JS_RemoveRoot(cx, &member_val->method_val);

View File

@ -174,15 +174,15 @@ JavaObject_finalize(JSContext *cx, JSObject *obj)
jobject java_obj;
JNIEnv *jEnv;
jsj_MapJSContextToJSJThread(cx, &jEnv);
if (!jEnv)
return;
java_wrapper = JS_GetPrivate(cx, obj);
if (!java_wrapper)
return;
java_obj = java_wrapper->java_obj;
jsj_MapJSContextToJSJThread(cx, &jEnv);
if (!jEnv)
return;
if (java_obj) {
remove_java_obj_reflection_from_hashtable(java_obj, jEnv);
(*jEnv)->DeleteGlobalRef(jEnv, java_obj);