From cbab844b5d027b083c332ed3ed602589dfed9aa0 Mon Sep 17 00:00:00 2001 From: "pedemont%us.ibm.com" Date: Wed, 27 Sep 2006 15:11:22 +0000 Subject: [PATCH] Bug 285591 - Do not cache JNIEnv structure. Instead, query from JavaVM. Not part of default build. a=mkaply Original committer: pedemont%us.ibm.com Original revision: 1.7 Original date: 2005/05/03 20:15:35 git-svn-id: svn://10.0.0.236/trunk@212515 18797224-902f-48f8-a5cc-f745e15eee43 --- .../java/xpcom/src/nsJavaXPTCStubWeakRef.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mozilla/extensions/java/xpcom/src/nsJavaXPTCStubWeakRef.cpp b/mozilla/extensions/java/xpcom/src/nsJavaXPTCStubWeakRef.cpp index f3deb9714ca..7cdb4a98028 100644 --- a/mozilla/extensions/java/xpcom/src/nsJavaXPTCStubWeakRef.cpp +++ b/mozilla/extensions/java/xpcom/src/nsJavaXPTCStubWeakRef.cpp @@ -15,7 +15,7 @@ * * The Initial Developer of the Original Code is * IBM Corporation. - * Portions created by the Initial Developer are Copyright (C) 2004 + * Portions created by the Initial Developer are Copyright (C) 2005 * IBM Corporation. All Rights Reserved. * * Contributor(s): @@ -56,17 +56,16 @@ * finding an XPTCStub for the required IID. */ -nsJavaXPTCStubWeakRef::nsJavaXPTCStubWeakRef(JNIEnv* env, jobject aJavaObject, +nsJavaXPTCStubWeakRef::nsJavaXPTCStubWeakRef(jobject aJavaObject, nsJavaXPTCStub* aXPTCStub) - : mJavaEnv(env) - , mXPTCStub(aXPTCStub) + : mXPTCStub(aXPTCStub) { - mWeakRef = mJavaEnv->NewWeakGlobalRef(aJavaObject); + mWeakRef = GetJNIEnv()->NewWeakGlobalRef(aJavaObject); } nsJavaXPTCStubWeakRef::~nsJavaXPTCStubWeakRef() { - mJavaEnv->DeleteWeakGlobalRef(mWeakRef); + GetJNIEnv()->DeleteWeakGlobalRef(mWeakRef); mXPTCStub->ReleaseWeakRef(); } @@ -83,7 +82,7 @@ nsJavaXPTCStubWeakRef::QueryReferent(const nsIID& aIID, void** aInstancePtr) // Is weak ref still valid? // We create a strong local ref to make sure Java object isn't garbage // collected during this call. - jobject javaObject = mJavaEnv->NewLocalRef(mWeakRef); + jobject javaObject = GetJNIEnv()->NewLocalRef(mWeakRef); if (!javaObject) return NS_ERROR_NULL_POINTER;