// Release a reference count and protect against reentrancy STDMETHODIMP_(ULONG) TffdshowPageBase::NonDelegatingRelease(void) { // If the reference count drops to zero delete ourselves if (InterlockedDecrement((LONG*)&m_cRef) == 0) { m_cRef++; SetPageSite(NULL); SetObjects(0, NULL); delete this; return ULONG(0); } else { return std::max(ULONG(m_cRef), 1ul); } }
STDMETHODIMP_(ULONG) CBasePropertyPage::NonDelegatingRelease() { // If the reference count drops to zero delete ourselves if (InterlockedDecrement(&m_cRef) == 0) { m_cRef++; SetPageSite(NULL); SetObjects(0,NULL); delete this; return ULONG(0); } else { return max(ULONG(m_cRef),1ul); } }