diff --git a/widget/src/windows/IENUMFE.CPP b/widget/src/windows/IENUMFE.CPP index 681cdef69cae..75e3f6912c6f 100644 --- a/widget/src/windows/IENUMFE.CPP +++ b/widget/src/windows/IENUMFE.CPP @@ -293,6 +293,7 @@ STDMETHODIMP CEnumFormatEtc::Reset(void) * * Purpose: * Returns another IEnumFORMATETC with the same state as ourselves. + * It is addrefed. * * Parameters: * ppEnum LPENUMFORMATETC * in which to return the diff --git a/widget/src/windows/nsDataObj.cpp b/widget/src/windows/nsDataObj.cpp index 14cc205d0db5..d996b8d0d554 100644 --- a/widget/src/windows/nsDataObj.cpp +++ b/widget/src/windows/nsDataObj.cpp @@ -435,8 +435,9 @@ STDMETHODIMP_(ULONG) nsDataObj::Release() if (0 < g_cRef) --g_cRef; + --m_cRef; NS_LOG_RELEASE(this, m_cRef, "nsDataObj"); - if (0 != --m_cRef) + if (0 != m_cRef) return m_cRef; delete this; @@ -754,16 +755,11 @@ STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum) break; } // switch - // Since a new one has been created, - // we will ref count the new clone here - // before giving it back if (NULL == *ppEnum) return ResultFromScode(E_FAIL); - else - (*ppEnum)->AddRef(); + // Clone already AddRefed the result so don't addref it again. return NOERROR; - } //-----------------------------------------------------