From 3cdcbbef6bfcf72bf6587bf9d5048ed561b31f4b Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Thu, 18 Aug 2005 11:29:12 +0000 Subject: [PATCH] Fix for bug 304374 (|nsCOMPtr iim = XPTI_GetInterfaceInfoManager()| leaks). r/sr=jst. --- content/xtf/src/nsXTFInterfaceAggregator.cpp | 3 ++- content/xtf/src/nsXTFWeakTearoff.cpp | 3 ++- extensions/java/xpcom/nsJavaWrapper.cpp | 6 ++++-- extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp | 3 ++- extensions/java/xpcom/nsJavaXPTCStub.cpp | 9 ++++++--- .../xpcom/tools/genifaces/GenerateJavaInterfaces.cpp | 6 ++++-- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/content/xtf/src/nsXTFInterfaceAggregator.cpp b/content/xtf/src/nsXTFInterfaceAggregator.cpp index c457e6eef9af..b27578006f13 100644 --- a/content/xtf/src/nsXTFInterfaceAggregator.cpp +++ b/content/xtf/src/nsXTFInterfaceAggregator.cpp @@ -143,7 +143,8 @@ nsXTFInterfaceAggregator::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP nsXTFInterfaceAggregator::GetInterfaceInfo(nsIInterfaceInfo** info) { - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim, "could not get interface info manager"); return iim->GetInfoForIID( &mIID, info); } diff --git a/content/xtf/src/nsXTFWeakTearoff.cpp b/content/xtf/src/nsXTFWeakTearoff.cpp index 2ba54c0f2798..51fb2da6bfc1 100644 --- a/content/xtf/src/nsXTFWeakTearoff.cpp +++ b/content/xtf/src/nsXTFWeakTearoff.cpp @@ -137,7 +137,8 @@ nsXTFWeakTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP nsXTFWeakTearoff::GetInterfaceInfo(nsIInterfaceInfo** info) { - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim, "could not get interface info manager"); return iim->GetInfoForIID( &mIID, info); } diff --git a/extensions/java/xpcom/nsJavaWrapper.cpp b/extensions/java/xpcom/nsJavaWrapper.cpp index 996cfb663086..18d8d09f9657 100644 --- a/extensions/java/xpcom/nsJavaWrapper.cpp +++ b/extensions/java/xpcom/nsJavaWrapper.cpp @@ -108,7 +108,8 @@ CreateJavaArray(JNIEnv* env, PRUint8 aType, PRUint32 aSize, const nsID& aIID, case nsXPTType::T_INTERFACE: case nsXPTType::T_INTERFACE_IS: { - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim != nsnull, "Failed to get InterfaceInfoManager"); if (!iim) return NS_ERROR_FAILURE; @@ -1616,7 +1617,8 @@ CreateJavaProxy(JNIEnv* env, nsISupports* aXPCOMObject, const nsIID& aIID, if (!aResult) return NS_ERROR_NULL_POINTER; - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim != nsnull, "Failed to get InterfaceInfoManager"); if (!iim) return NS_ERROR_FAILURE; diff --git a/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp b/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp index e9dd786ee351..e0809902a460 100644 --- a/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp +++ b/extensions/java/xpcom/nsJavaXPCOMBindingUtils.cpp @@ -791,7 +791,8 @@ GetNewOrUsedXPCOMObject(JNIEnv* env, jobject aJavaObject, const nsIID& aIID, // create an XPCOM stub, that can route any method calls to the class. // Get interface info for class - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); nsCOMPtr iinfo; rv = iim->GetInfoForIID(&aIID, getter_AddRefs(iinfo)); if (NS_FAILED(rv)) diff --git a/extensions/java/xpcom/nsJavaXPTCStub.cpp b/extensions/java/xpcom/nsJavaXPTCStub.cpp index 44227412d253..c7408ed8ff51 100644 --- a/extensions/java/xpcom/nsJavaXPTCStub.cpp +++ b/extensions/java/xpcom/nsJavaXPTCStub.cpp @@ -289,7 +289,8 @@ nsJavaXPTCStub::QueryInterface(const nsID &aIID, void **aInstancePtr) return NS_NOINTERFACE; // Get interface info for new java object - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); nsCOMPtr iinfo; nsresult rv = iim->GetInfoForIID(&aIID, getter_AddRefs(iinfo)); if (NS_FAILED(rv)) @@ -891,7 +892,8 @@ nsJavaXPTCStub::SetupJavaParams(const nsXPTParamInfo &aParamInfo, // get name of interface char* iface_name = nsnull; - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); rv = iim->GetNameForIID(&iid, &iface_name); if (NS_FAILED(rv) || !iface_name) break; @@ -1118,7 +1120,8 @@ nsJavaXPTCStub::GetRetvalSig(const nsXPTParamInfo* aParamInfo, // get name of interface char* iface_name = nsnull; - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); rv = iim->GetNameForIID(&iid, &iface_name); if (NS_FAILED(rv) || !iface_name) break; diff --git a/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp b/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp index 88d169bf9c61..b9d2cd5bbaee 100644 --- a/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp +++ b/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp @@ -119,7 +119,8 @@ public: // a non-scriptable interface, output |nsISupports| instead of the // interface name. nsCOMPtr info; - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim, "could not get interface info manager"); rv = iim->GetInfoForIID(iid, getter_AddRefs(info)); NS_ENSURE_SUCCESS(rv, rv); @@ -209,7 +210,8 @@ public: { nsresult rv; - nsCOMPtr iim = XPTI_GetInterfaceInfoManager(); + nsCOMPtr iim = + getter_AddRefs(XPTI_GetInterfaceInfoManager()); NS_ASSERTION(iim, "could not get interface info manager"); nsCOMPtr etor; rv = iim->EnumerateInterfaces(getter_AddRefs(etor));