зеркало из https://github.com/mozilla/gecko-dev.git
Bug fix for 12603. I am not sure if this totally cleans up all the memory
leaks but it definitely hits a major one.
This commit is contained in:
Родитель
3f154a0c36
Коммит
74f259e911
|
@ -235,8 +235,7 @@ nsProxyObject::AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *met
|
|||
continue;
|
||||
|
||||
if ( (convertType == convertOutParameters && paramInfo.IsOut()) ||
|
||||
(convertType == convertInParameters && paramInfo.IsIn()) ||
|
||||
(convertType == convertAllParameters)) //TODO: need to remove.
|
||||
(convertType == convertInParameters && paramInfo.IsIn()) )
|
||||
{
|
||||
// We found an out parameter which is a interface, check for proxy
|
||||
if (params[i].val.p == nsnull)
|
||||
|
@ -255,8 +254,8 @@ nsProxyObject::AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *met
|
|||
|
||||
nsISupports *aProxyObject;
|
||||
|
||||
// I wish I could get rid of this instance of |NS_DEFINE_IID|, but |ProxyEventClassIdentity| is not visible from here
|
||||
static NS_DEFINE_IID(kProxyObject_Identity_Class_IID, NS_PROXYEVENT_IDENTITY_CLASS_IID);
|
||||
// ssc@netscape.com wishes he could get rid of this instance of |NS_DEFINE_IID|, but |ProxyEventClassIdentity| is not visible from here
|
||||
static NS_DEFINE_IID(kProxyObject_Identity_Class_IID, NS_PROXYEVENT_IDENTITY_CLASS_IID);
|
||||
rv = anInterface->QueryInterface(kProxyObject_Identity_Class_IID, (void**)&aProxyObject);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -362,10 +361,17 @@ nsProxyObject::AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *met
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// stuff the new proxies into the val.p. If it is an OUT parameter, release once
|
||||
// the real object to force the proxy to be the owner.
|
||||
if (paramInfo.IsOut())
|
||||
{
|
||||
anInterface->Release();
|
||||
*((void**)params[i].val.p) = ((void*)aProxyObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
(params[i].val.p) = ((void*)aProxyObject);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -378,6 +384,18 @@ nsProxyObject::AutoProxyParameterList(PRUint32 methodIndex, nsXPTMethodInfo *met
|
|||
// It already is a proxy!
|
||||
}
|
||||
}
|
||||
else if ( (convertType == convertOutParameters) && paramInfo.IsIn() )
|
||||
{
|
||||
// we need to Release() any |in| parameters that we created proxies for
|
||||
// and replace the proxied object with the real object on the stack.
|
||||
nsProxyEventObject* replaceInterface = ((nsProxyEventObject*)params[i].val.p);
|
||||
if (replaceInterface)
|
||||
{
|
||||
nsISupports* realObject = replaceInterface->GetRealObject();
|
||||
replaceInterface->Release();
|
||||
(params[i].val.p) = ((void*)realObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ public:
|
|||
REFNSIID GetIID() const {return GetClass()->GetIID();}
|
||||
nsProxyEventClass* GetClass() const { return mClass; }
|
||||
|
||||
nsISupports* GetRealObject() const { return mProxyObject->GetRealObject(); }
|
||||
nsProxyEventObject* GetRootProxyObject() const { return mRoot; }
|
||||
|
||||
nsProxyEventObject* Find(REFNSIID aIID);
|
||||
|
|
Загрузка…
Ссылка в новой задаче