diff --git a/extensions/java/xpcom/nsJavaInterfaces.cpp b/extensions/java/xpcom/nsJavaInterfaces.cpp index 13437320048..6abe63d14b0 100644 --- a/extensions/java/xpcom/nsJavaInterfaces.cpp +++ b/extensions/java/xpcom/nsJavaInterfaces.cpp @@ -182,7 +182,8 @@ XPCOM_NATIVE(NS_1NewSingletonEnumerator) (JNIEnv *env, jclass, jobject aSingleto nsISupports* singleton; if (IsXPTCStub(inst)) - singleton = (nsISupports*) GetXPTCStubAddr(inst); + GetXPTCStubAddr(inst)->QueryInterface(NS_GET_IID(nsISupports), + (void**) &singleton); else { JavaXPCOMInstance* xpcomInst = (JavaXPCOMInstance*) inst; singleton = xpcomInst->GetInstance(); diff --git a/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp b/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp index dc89139e0a0..54e08bfa13a 100644 --- a/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp +++ b/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp @@ -175,17 +175,19 @@ RemoveXPCOMBinding(JNIEnv* env, jobject aJavaObject) LOG("- Removing Java<->XPCOM binding (Java=0x%08x | XPCOM=0x%08x)\n", hash, (int) xpcomObj); + nsISupports* inst = nsnull; if (IsXPTCStub(xpcomObj)) { - return (nsISupports*) GetXPTCStubAddr(xpcomObj); + GetXPTCStubAddr(xpcomObj)->QueryInterface(NS_GET_IID(nsISupports), + (void**) &inst); } else { JavaXPCOMInstance* xpcomInst = (JavaXPCOMInstance*) xpcomObj; - nsISupports* inst = xpcomInst->GetInstance(); + inst = xpcomInst->GetInstance(); // XXX Getting some odd thread issues when calling this. Addreffing for // now to work around the errors. NS_ADDREF(inst); delete xpcomInst; - return inst; } + return inst; } void diff --git a/extensions/java/xpcom/nsJavaXPCOMBindingUtils.h b/extensions/java/xpcom/nsJavaXPCOMBindingUtils.h index 7dcc87ff8b9..26c3b14e01a 100644 --- a/extensions/java/xpcom/nsJavaXPCOMBindingUtils.h +++ b/extensions/java/xpcom/nsJavaXPCOMBindingUtils.h @@ -45,7 +45,7 @@ #ifdef DEBUG_pedemonte #define LOG(...) printf(__VA_ARGS__) #else -#define LOG(format, ...) +#define LOG(...) /* nothing */ #endif diff --git a/extensions/java/xpcom/nsJavaXPTCStub.h b/extensions/java/xpcom/nsJavaXPTCStub.h index 53e76725a76..84442cab47e 100644 --- a/extensions/java/xpcom/nsJavaXPTCStub.h +++ b/extensions/java/xpcom/nsJavaXPTCStub.h @@ -101,12 +101,12 @@ private: inline void* SetAsXPTCStub(nsJavaXPTCStub* ptr) { NS_PRECONDITION(ptr, "null pointer"); return (void*) (((unsigned long) ptr) | 0x1); } - - inline PRBool IsXPTCStub(void* ptr) + +inline PRBool IsXPTCStub(void* ptr) { NS_PRECONDITION(ptr, "null pointer"); return ((unsigned long) ptr) & 0x1; } - - inline nsJavaXPTCStub* GetXPTCStubAddr(void* ptr) + +inline nsJavaXPTCStub* GetXPTCStubAddr(void* ptr) { NS_PRECONDITION(ptr, "null pointer"); return (nsJavaXPTCStub*) (((unsigned long) ptr) & ~0x1); }