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
This commit is contained in:
parent
400c6dab3f
commit
cbab844b5d
@ -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;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user