зеркало из https://github.com/mozilla/gecko-dev.git
Bug 414482. Don't leak by double-addreffing in CEnumFormatEtc::Clone. Also, fix nsDataObj refcnt logging so we don't appear to be leaking those. r=jmathies,sr=jonas
This commit is contained in:
Родитель
c2ddaf9925
Коммит
bb395f76ba
|
@ -293,6 +293,7 @@ STDMETHODIMP CEnumFormatEtc::Reset(void)
|
||||||
*
|
*
|
||||||
* Purpose:
|
* Purpose:
|
||||||
* Returns another IEnumFORMATETC with the same state as ourselves.
|
* Returns another IEnumFORMATETC with the same state as ourselves.
|
||||||
|
* It is addrefed.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ppEnum LPENUMFORMATETC * in which to return the
|
* ppEnum LPENUMFORMATETC * in which to return the
|
||||||
|
|
|
@ -435,8 +435,9 @@ STDMETHODIMP_(ULONG) nsDataObj::Release()
|
||||||
if (0 < g_cRef)
|
if (0 < g_cRef)
|
||||||
--g_cRef;
|
--g_cRef;
|
||||||
|
|
||||||
|
--m_cRef;
|
||||||
NS_LOG_RELEASE(this, m_cRef, "nsDataObj");
|
NS_LOG_RELEASE(this, m_cRef, "nsDataObj");
|
||||||
if (0 != --m_cRef)
|
if (0 != m_cRef)
|
||||||
return m_cRef;
|
return m_cRef;
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
|
@ -754,16 +755,11 @@ STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum)
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
|
|
||||||
// Since a new one has been created,
|
|
||||||
// we will ref count the new clone here
|
|
||||||
// before giving it back
|
|
||||||
if (NULL == *ppEnum)
|
if (NULL == *ppEnum)
|
||||||
return ResultFromScode(E_FAIL);
|
return ResultFromScode(E_FAIL);
|
||||||
else
|
|
||||||
(*ppEnum)->AddRef();
|
|
||||||
|
|
||||||
|
// Clone already AddRefed the result so don't addref it again.
|
||||||
return NOERROR;
|
return NOERROR;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
Загрузка…
Ссылка в новой задаче