strmbase: Separate BasePin destructors from Release.

This commit is contained in:
Thomas Faber 2014-07-27 11:34:50 +02:00 committed by Alexandre Julliard
parent 33e0e6867f
commit 4ea1f35777
2 changed files with 25 additions and 11 deletions

View File

@ -401,11 +401,7 @@ ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface)
if (!refCount) if (!refCount)
{ {
FreeMediaType(&This->pin.mtCurrent); BaseOutputPin_Destroy(This);
if (This->pAllocator)
IMemAllocator_Release(This->pAllocator);
This->pAllocator = NULL;
CoTaskMemFree(This);
return 0; return 0;
} }
return refCount; return refCount;
@ -849,6 +845,16 @@ HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outp
return E_FAIL; return E_FAIL;
} }
HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This)
{
FreeMediaType(&This->pin.mtCurrent);
if (This->pAllocator)
IMemAllocator_Release(This->pAllocator);
This->pAllocator = NULL;
CoTaskMemFree(This);
return S_OK;
}
/*** Input Pin implementation ***/ /*** Input Pin implementation ***/
static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface ) static inline BaseInputPin *impl_BaseInputPin_from_IPin( IPin *iface )
@ -900,12 +906,7 @@ ULONG WINAPI BaseInputPinImpl_Release(IPin * iface)
if (!refCount) if (!refCount)
{ {
FreeMediaType(&This->pin.mtCurrent); BaseInputPin_Destroy(This);
if (This->pAllocator)
IMemAllocator_Release(This->pAllocator);
This->pAllocator = NULL;
This->pin.IPin_iface.lpVtbl = NULL;
CoTaskMemFree(This);
return 0; return 0;
} }
else else
@ -1273,3 +1274,14 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size
CoTaskMemFree(pPinImpl); CoTaskMemFree(pPinImpl);
return E_FAIL; return E_FAIL;
} }
HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This)
{
FreeMediaType(&This->pin.mtCurrent);
if (This->pAllocator)
IMemAllocator_Release(This->pAllocator);
This->pAllocator = NULL;
This->pin.IPin_iface.lpVtbl = NULL;
CoTaskMemFree(This);
return S_OK;
}

View File

@ -136,6 +136,7 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *This, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt); HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BasePin *This, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin); HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, const BaseOutputPinFuncTable* pBaseOutputFuncsTable, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
HRESULT WINAPI BaseOutputPin_Destroy(BaseOutputPin *This);
/* Base Input Pin */ /* Base Input Pin */
HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv); HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
@ -151,6 +152,7 @@ HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart,
HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo, HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size, const PIN_INFO * pPinInfo,
const BaseInputPinFuncTable* pBaseInputFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable,
LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This);
typedef struct BaseFilter typedef struct BaseFilter
{ {