зеркало из https://github.com/mozilla/pjs.git
Bug 344623 - leaks caused by incorrect refcounting in bug 342311, r=darin
This commit is contained in:
Родитель
5352285b67
Коммит
3244b5d297
|
@ -338,6 +338,8 @@ nsProxyObject::nsProxyObject(nsIEventTarget *target, PRInt32 proxyType,
|
|||
mRealObject(realObject),
|
||||
mFirst(nsnull)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsProxyObject);
|
||||
|
||||
nsProxyObjectManager *pom = nsProxyObjectManager::GetInstance();
|
||||
NS_ASSERTION(pom, "Creating a proxy without a global proxy-object-manager.");
|
||||
pom->AddRef();
|
||||
|
@ -350,6 +352,8 @@ nsProxyObject::~nsProxyObject()
|
|||
nsISupports *doomed = nsnull;
|
||||
mRealObject.swap(doomed);
|
||||
NS_ProxyRelease(mTarget, doomed);
|
||||
|
||||
MOZ_COUNT_DTOR(nsProxyObject);
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsProxyObject)
|
||||
|
@ -369,6 +373,7 @@ nsProxyObject::Release()
|
|||
|
||||
pom->Remove(this);
|
||||
pom->Release();
|
||||
delete this;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -422,7 +427,8 @@ nsProxyObject::LockedFind(REFNSIID aIID, void **aResult)
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
peo = new nsProxyEventObject(this, pec, newInterface);
|
||||
peo = new nsProxyEventObject(this, pec,
|
||||
already_AddRefed<nsISomeInterface>(newInterface));
|
||||
if (!peo)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
nsProxyEventObject::nsProxyEventObject(nsProxyObject *aParent,
|
||||
nsProxyEventClass* aClass,
|
||||
nsISomeInterface* aRealInterface)
|
||||
already_AddRefed<nsISomeInterface> aRealInterface)
|
||||
: mRealInterface(aRealInterface),
|
||||
mClass(aClass),
|
||||
mProxyObject(aParent),
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
|
||||
nsProxyEventObject(nsProxyObject *aParent,
|
||||
nsProxyEventClass *aClass,
|
||||
nsISomeInterface *aRealInterface);
|
||||
already_AddRefed<nsISomeInterface> aRealInterface);
|
||||
|
||||
friend class nsProxyObject;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче