- Use Interlocked* functions in AddRef and Release.
- Store the result of the Interlocked functions and use only this.
This commit is contained in:
parent
5f0e554af5
commit
c6559a104c
|
@ -410,19 +410,21 @@ static HRESULT WINAPI AVIDec_QueryInterface(IBaseFilter * iface, REFIID riid, LP
|
||||||
static ULONG WINAPI AVIDec_AddRef(IBaseFilter * iface)
|
static ULONG WINAPI AVIDec_AddRef(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
AVIDecImpl *This = (AVIDecImpl *)iface;
|
AVIDecImpl *This = (AVIDecImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI AVIDec_Release(IBaseFilter * iface)
|
static ULONG WINAPI AVIDec_Release(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
AVIDecImpl *This = (AVIDecImpl *)iface;
|
AVIDecImpl *This = (AVIDecImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
|
@ -449,7 +451,7 @@ static ULONG WINAPI AVIDec_Release(IBaseFilter * iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IPersist methods **/
|
/** IPersist methods **/
|
||||||
|
|
|
@ -211,19 +211,21 @@ static HRESULT WINAPI AVISplitter_QueryInterface(IBaseFilter * iface, REFIID rii
|
||||||
static ULONG WINAPI AVISplitter_AddRef(IBaseFilter * iface)
|
static ULONG WINAPI AVISplitter_AddRef(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
AVISplitter *This = (AVISplitter *)iface;
|
AVISplitter *This = (AVISplitter *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI AVISplitter_Release(IBaseFilter * iface)
|
static ULONG WINAPI AVISplitter_Release(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
AVISplitter *This = (AVISplitter *)iface;
|
AVISplitter *This = (AVISplitter *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
|
@ -243,7 +245,7 @@ static ULONG WINAPI AVISplitter_Release(IBaseFilter * iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IPersist methods **/
|
/** IPersist methods **/
|
||||||
|
@ -1116,10 +1118,11 @@ HRESULT WINAPI AVISplitter_OutputPin_QueryInterface(IPin * iface, REFIID riid, L
|
||||||
static ULONG WINAPI AVISplitter_OutputPin_Release(IPin * iface)
|
static ULONG WINAPI AVISplitter_OutputPin_Release(IPin * iface)
|
||||||
{
|
{
|
||||||
AVISplitter_OutputPin *This = (AVISplitter_OutputPin *)iface;
|
AVISplitter_OutputPin *This = (AVISplitter_OutputPin *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->pin.pin.refCount);
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->pin.pin.refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
DeleteMediaType(This->pmt);
|
DeleteMediaType(This->pmt);
|
||||||
CoTaskMemFree(This->pmt);
|
CoTaskMemFree(This->pmt);
|
||||||
|
@ -1127,7 +1130,7 @@ static ULONG WINAPI AVISplitter_OutputPin_Release(IPin * iface)
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->pin.pin.refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI AVISplitter_OutputPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
|
static HRESULT WINAPI AVISplitter_OutputPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
|
||||||
|
|
|
@ -358,19 +358,21 @@ static HRESULT WINAPI DSoundRender_QueryInterface(IBaseFilter * iface, REFIID ri
|
||||||
static ULONG WINAPI DSoundRender_AddRef(IBaseFilter * iface)
|
static ULONG WINAPI DSoundRender_AddRef(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
|
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
|
static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
|
DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
DeleteCriticalSection(&This->csFilter);
|
DeleteCriticalSection(&This->csFilter);
|
||||||
if (This->pClock)
|
if (This->pClock)
|
||||||
|
@ -388,7 +390,7 @@ static ULONG WINAPI DSoundRender_Release(IBaseFilter * iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IPersist methods **/
|
/** IPersist methods **/
|
||||||
|
|
|
@ -92,22 +92,28 @@ static HRESULT WINAPI IEnumFiltersImpl_QueryInterface(IEnumFilters * iface, REFI
|
||||||
static ULONG WINAPI IEnumFiltersImpl_AddRef(IEnumFilters * iface)
|
static ULONG WINAPI IEnumFiltersImpl_AddRef(IEnumFilters * iface)
|
||||||
{
|
{
|
||||||
IEnumFiltersImpl *This = (IEnumFiltersImpl *)iface;
|
IEnumFiltersImpl *This = (IEnumFiltersImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)->()\n", iface);
|
TRACE("(%p)->()\n", iface);
|
||||||
return ++This->refCount;
|
|
||||||
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IEnumFiltersImpl_Release(IEnumFilters * iface)
|
static ULONG WINAPI IEnumFiltersImpl_Release(IEnumFilters * iface)
|
||||||
{
|
{
|
||||||
IEnumFiltersImpl *This = (IEnumFiltersImpl *)iface;
|
IEnumFiltersImpl *This = (IEnumFiltersImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)->()\n", iface);
|
TRACE("(%p)->()\n", iface);
|
||||||
if (!--This->refCount)
|
|
||||||
|
if (!refCount)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(This->ppFilters);
|
CoTaskMemFree(This->ppFilters);
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IEnumFiltersImpl_Next(IEnumFilters * iface, ULONG cFilters, IBaseFilter ** ppFilters, ULONG * pcFetched)
|
static HRESULT WINAPI IEnumFiltersImpl_Next(IEnumFilters * iface, ULONG cFilters, IBaseFilter ** ppFilters, ULONG * pcFetched)
|
||||||
|
|
|
@ -120,22 +120,28 @@ static HRESULT WINAPI IEnumMediaTypesImpl_QueryInterface(IEnumMediaTypes * iface
|
||||||
static ULONG WINAPI IEnumMediaTypesImpl_AddRef(IEnumMediaTypes * iface)
|
static ULONG WINAPI IEnumMediaTypesImpl_AddRef(IEnumMediaTypes * iface)
|
||||||
{
|
{
|
||||||
IEnumMediaTypesImpl *This = (IEnumMediaTypesImpl *)iface;
|
IEnumMediaTypesImpl *This = (IEnumMediaTypesImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
return ++This->refCount;
|
|
||||||
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IEnumMediaTypesImpl_Release(IEnumMediaTypes * iface)
|
static ULONG WINAPI IEnumMediaTypesImpl_Release(IEnumMediaTypes * iface)
|
||||||
{
|
{
|
||||||
IEnumMediaTypesImpl *This = (IEnumMediaTypesImpl *)iface;
|
IEnumMediaTypesImpl *This = (IEnumMediaTypesImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
if (!--This->refCount)
|
|
||||||
|
if (!refCount)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(This->enumMediaDetails.pMediaTypes);
|
CoTaskMemFree(This->enumMediaDetails.pMediaTypes);
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes * iface, ULONG cMediaTypes, AM_MEDIA_TYPE ** ppMediaTypes, ULONG * pcFetched)
|
static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes * iface, ULONG cMediaTypes, AM_MEDIA_TYPE ** ppMediaTypes, ULONG * pcFetched)
|
||||||
|
|
|
@ -120,17 +120,18 @@ static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface)
|
||||||
static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface)
|
static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface)
|
||||||
{
|
{
|
||||||
EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
|
EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->ref))
|
if (!ref)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(This->ppMoniker);
|
CoTaskMemFree(This->ppMoniker);
|
||||||
This->ppMoniker = NULL;
|
This->ppMoniker = NULL;
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched)
|
static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched)
|
||||||
|
|
|
@ -75,25 +75,27 @@ static HRESULT WINAPI IEnumPinsImpl_QueryInterface(IEnumPins * iface, REFIID rii
|
||||||
static ULONG WINAPI IEnumPinsImpl_AddRef(IEnumPins * iface)
|
static ULONG WINAPI IEnumPinsImpl_AddRef(IEnumPins * iface)
|
||||||
{
|
{
|
||||||
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
|
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
return ++This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
|
static ULONG WINAPI IEnumPinsImpl_Release(IEnumPins * iface)
|
||||||
{
|
{
|
||||||
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
|
IEnumPinsImpl *This = (IEnumPinsImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
if (!--This->refCount)
|
if (!refCount)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** ppPins, ULONG * pcFetched)
|
static HRESULT WINAPI IEnumPinsImpl_Next(IEnumPins * iface, ULONG cPins, IPin ** ppPins, ULONG * pcFetched)
|
||||||
|
|
|
@ -115,24 +115,26 @@ static HRESULT WINAPI IEnumRegFiltersImpl_QueryInterface(IEnumRegFilters * iface
|
||||||
static ULONG WINAPI IEnumRegFiltersImpl_AddRef(IEnumRegFilters * iface)
|
static ULONG WINAPI IEnumRegFiltersImpl_AddRef(IEnumRegFilters * iface)
|
||||||
{
|
{
|
||||||
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface;
|
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)\n", iface);
|
TRACE("(%p)\n", iface);
|
||||||
|
|
||||||
return ++This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI IEnumRegFiltersImpl_Release(IEnumRegFilters * iface)
|
static ULONG WINAPI IEnumRegFiltersImpl_Release(IEnumRegFilters * iface)
|
||||||
{
|
{
|
||||||
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface;
|
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)\n", iface);
|
TRACE("(%p)\n", iface);
|
||||||
|
|
||||||
if (!--This->refCount)
|
if (!refCount)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IEnumRegFiltersImpl_Next(IEnumRegFilters * iface, ULONG cFilters, REGFILTER ** ppRegFilter, ULONG * pcFetched)
|
static HRESULT WINAPI IEnumRegFiltersImpl_Next(IEnumRegFilters * iface, ULONG cFilters, REGFILTER ** ppRegFilter, ULONG * pcFetched)
|
||||||
|
|
|
@ -357,19 +357,21 @@ static HRESULT WINAPI AsyncReader_QueryInterface(IBaseFilter * iface, REFIID rii
|
||||||
static ULONG WINAPI AsyncReader_AddRef(IBaseFilter * iface)
|
static ULONG WINAPI AsyncReader_AddRef(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
AsyncReader *This = (AsyncReader *)iface;
|
AsyncReader *This = (AsyncReader *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
|
static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
AsyncReader *This = (AsyncReader *)iface;
|
AsyncReader *This = (AsyncReader *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
if (This->pOutputPin)
|
if (This->pOutputPin)
|
||||||
IPin_Release(This->pOutputPin);
|
IPin_Release(This->pOutputPin);
|
||||||
|
@ -379,7 +381,7 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IPersist methods **/
|
/** IPersist methods **/
|
||||||
|
@ -736,10 +738,11 @@ static HRESULT WINAPI FileAsyncReaderPin_QueryInterface(IPin * iface, REFIID rii
|
||||||
static ULONG WINAPI FileAsyncReaderPin_Release(IPin * iface)
|
static ULONG WINAPI FileAsyncReaderPin_Release(IPin * iface)
|
||||||
{
|
{
|
||||||
FileAsyncReader *This = (FileAsyncReader *)iface;
|
FileAsyncReader *This = (FileAsyncReader *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->pin.pin.refCount);
|
||||||
|
|
||||||
TRACE("()\n");
|
TRACE("()\n");
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->pin.pin.refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
DATAREQUEST * pCurrent;
|
DATAREQUEST * pCurrent;
|
||||||
DATAREQUEST * pNext;
|
DATAREQUEST * pNext;
|
||||||
|
@ -753,7 +756,7 @@ static ULONG WINAPI FileAsyncReaderPin_Release(IPin * iface)
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->pin.pin.refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI FileAsyncReaderPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
|
static HRESULT WINAPI FileAsyncReaderPin_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum)
|
||||||
|
|
|
@ -227,22 +227,23 @@ static HRESULT Filtergraph_QueryInterface(IFilterGraphImpl *This,
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
This->ref++;
|
InterlockedIncrement(&This->ref);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG Filtergraph_AddRef(IFilterGraphImpl *This) {
|
static ULONG Filtergraph_AddRef(IFilterGraphImpl *This) {
|
||||||
TRACE("(%p)->(): new ref = %ld\n", This, This->ref + 1);
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
return ++This->ref;
|
TRACE("(%p)->(): new ref = %ld\n", This, ref);
|
||||||
|
|
||||||
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG Filtergraph_Release(IFilterGraphImpl *This) {
|
static ULONG Filtergraph_Release(IFilterGraphImpl *This) {
|
||||||
static ULONG ref;
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(): new ref = %ld\n", This, This->ref - 1);
|
TRACE("(%p)->(): new ref = %ld\n", This, ref);
|
||||||
|
|
||||||
ref = --This->ref;
|
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
IFilterMapper2_Release(This->pFilterMapper2);
|
IFilterMapper2_Release(This->pFilterMapper2);
|
||||||
CloseHandle(This->hEventCompletion);
|
CloseHandle(This->hEventCompletion);
|
||||||
|
|
|
@ -210,24 +210,26 @@ static HRESULT WINAPI FilterMapper2_QueryInterface(IFilterMapper2 * iface, REFII
|
||||||
static ULONG WINAPI FilterMapper2_AddRef(IFilterMapper2 * iface)
|
static ULONG WINAPI FilterMapper2_AddRef(IFilterMapper2 * iface)
|
||||||
{
|
{
|
||||||
FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
|
FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)->()\n", iface);
|
TRACE("(%p)->()\n", iface);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI FilterMapper2_Release(IFilterMapper2 * iface)
|
static ULONG WINAPI FilterMapper2_Release(IFilterMapper2 * iface)
|
||||||
{
|
{
|
||||||
FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
|
FilterMapper2Impl *This = (FilterMapper2Impl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)->()\n", iface);
|
TRACE("(%p)->()\n", iface);
|
||||||
|
|
||||||
if (InterlockedDecrement(&This->refCount) == 0)
|
if (refCount == 0)
|
||||||
{
|
{
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** IFilterMapper2 methods ***/
|
/*** IFilterMapper2 methods ***/
|
||||||
|
|
|
@ -139,19 +139,21 @@ static HRESULT WINAPI BaseMemAllocator_QueryInterface(IMemAllocator * iface, REF
|
||||||
static ULONG WINAPI BaseMemAllocator_AddRef(IMemAllocator * iface)
|
static ULONG WINAPI BaseMemAllocator_AddRef(IMemAllocator * iface)
|
||||||
{
|
{
|
||||||
BaseMemAllocator *This = (BaseMemAllocator *)iface;
|
BaseMemAllocator *This = (BaseMemAllocator *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->() AddRef from %ld\n", iface, This->ref);
|
TRACE("(%p)->() AddRef from %ld\n", iface, ref - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->ref);
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator * iface)
|
static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator * iface)
|
||||||
{
|
{
|
||||||
BaseMemAllocator *This = (BaseMemAllocator *)iface;
|
BaseMemAllocator *This = (BaseMemAllocator *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->() Release from %ld\n", iface, This->ref);
|
TRACE("(%p)->() Release from %ld\n", iface, ref + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->ref))
|
if (!ref)
|
||||||
{
|
{
|
||||||
CloseHandle(This->hSemWaiting);
|
CloseHandle(This->hSemWaiting);
|
||||||
if (This->bCommitted)
|
if (This->bCommitted)
|
||||||
|
@ -160,7 +162,7 @@ static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator * iface)
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator * iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual)
|
static HRESULT WINAPI BaseMemAllocator_SetProperties(IMemAllocator * iface, ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual)
|
||||||
|
@ -471,24 +473,26 @@ static HRESULT WINAPI StdMediaSample2_QueryInterface(IMediaSample2 * iface, REFI
|
||||||
static ULONG WINAPI StdMediaSample2_AddRef(IMediaSample2 * iface)
|
static ULONG WINAPI StdMediaSample2_AddRef(IMediaSample2 * iface)
|
||||||
{
|
{
|
||||||
StdMediaSample2 *This = (StdMediaSample2 *)iface;
|
StdMediaSample2 *This = (StdMediaSample2 *)iface;
|
||||||
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->() AddRef from %ld\n", iface, This->ref);
|
TRACE("(%p)->() AddRef from %ld\n", iface, ref - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->ref);
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
|
static ULONG WINAPI StdMediaSample2_Release(IMediaSample2 * iface)
|
||||||
{
|
{
|
||||||
StdMediaSample2 *This = (StdMediaSample2 *)iface;
|
StdMediaSample2 *This = (StdMediaSample2 *)iface;
|
||||||
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->() Release from %ld\n", iface, This->ref);
|
TRACE("(%p)->() Release from %ld\n", iface, ref + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->ref))
|
if (!ref)
|
||||||
{
|
{
|
||||||
IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
|
IMemAllocator_ReleaseBuffer(This->pParent, (IMediaSample *)iface);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 * iface, BYTE ** ppBuffer)
|
static HRESULT WINAPI StdMediaSample2_GetPointer(IMediaSample2 * iface, BYTE ** ppBuffer)
|
||||||
|
|
|
@ -226,10 +226,11 @@ HRESULT OutputPin_Construct(const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *pro
|
||||||
ULONG WINAPI IPinImpl_AddRef(IPin * iface)
|
ULONG WINAPI IPinImpl_AddRef(IPin * iface)
|
||||||
{
|
{
|
||||||
IPinImpl *This = (IPinImpl *)iface;
|
IPinImpl *This = (IPinImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p)->() AddRef from %ld\n", iface, This->refCount);
|
TRACE("(%p)->() AddRef from %ld\n", iface, refCount - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IPinImpl_Disconnect(IPin * iface)
|
HRESULT WINAPI IPinImpl_Disconnect(IPin * iface)
|
||||||
|
@ -403,10 +404,11 @@ HRESULT WINAPI InputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
|
||||||
ULONG WINAPI InputPin_Release(IPin * iface)
|
ULONG WINAPI InputPin_Release(IPin * iface)
|
||||||
{
|
{
|
||||||
InputPin *This = (InputPin *)iface;
|
InputPin *This = (InputPin *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->pin.refCount);
|
||||||
|
|
||||||
TRACE("(%p)->() Release from %ld\n", iface, This->pin.refCount);
|
TRACE("(%p)->() Release from %ld\n", iface, refCount + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->pin.refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
DeleteMediaType(&This->pin.mtCurrent);
|
DeleteMediaType(&This->pin.mtCurrent);
|
||||||
if (This->pAllocator)
|
if (This->pAllocator)
|
||||||
|
@ -415,7 +417,7 @@ ULONG WINAPI InputPin_Release(IPin * iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->pin.refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt)
|
HRESULT WINAPI InputPin_Connect(IPin * iface, IPin * pConnector, const AM_MEDIA_TYPE * pmt)
|
||||||
|
@ -661,16 +663,17 @@ HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
|
||||||
ULONG WINAPI OutputPin_Release(IPin * iface)
|
ULONG WINAPI OutputPin_Release(IPin * iface)
|
||||||
{
|
{
|
||||||
OutputPin *This = (OutputPin *)iface;
|
OutputPin *This = (OutputPin *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->pin.refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", This, iface);
|
TRACE("(%p/%p)->()\n", This, iface);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->pin.refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
DeleteMediaType(&This->pin.mtCurrent);
|
DeleteMediaType(&This->pin.mtCurrent);
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->pin.refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
|
HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
|
||||||
|
@ -1114,10 +1117,11 @@ HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
|
||||||
ULONG WINAPI PullPin_Release(IPin * iface)
|
ULONG WINAPI PullPin_Release(IPin * iface)
|
||||||
{
|
{
|
||||||
PullPin *This = (PullPin *)iface;
|
PullPin *This = (PullPin *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->pin.refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->()\n", This, iface);
|
TRACE("(%p/%p)->()\n", This, iface);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->pin.refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
if (This->hThread)
|
if (This->hThread)
|
||||||
PullPin_StopProcessing(This);
|
PullPin_StopProcessing(This);
|
||||||
|
@ -1127,7 +1131,7 @@ ULONG WINAPI PullPin_Release(IPin * iface)
|
||||||
CoTaskMemFree(This);
|
CoTaskMemFree(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return This->pin.refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD WINAPI PullPin_Thread_Main(LPVOID pv)
|
static DWORD WINAPI PullPin_Thread_Main(LPVOID pv)
|
||||||
|
|
|
@ -197,8 +197,11 @@ IReferenceClockVtbl SystemClock_Vtbl;
|
||||||
|
|
||||||
static ULONG WINAPI SystemClockImpl_AddRef(IReferenceClock* iface) {
|
static ULONG WINAPI SystemClockImpl_AddRef(IReferenceClock* iface) {
|
||||||
SystemClockImpl *This = (SystemClockImpl *)iface;
|
SystemClockImpl *This = (SystemClockImpl *)iface;
|
||||||
TRACE("(%p): AddRef from %ld\n", This, This->ref);
|
ULONG ref = InterlockedIncrement(&This->ref);
|
||||||
return ++(This->ref);
|
|
||||||
|
TRACE("(%p): AddRef from %ld\n", This, ref - 1);
|
||||||
|
|
||||||
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI SystemClockImpl_QueryInterface(IReferenceClock* iface, REFIID riid, void** ppobj) {
|
static HRESULT WINAPI SystemClockImpl_QueryInterface(IReferenceClock* iface, REFIID riid, void** ppobj) {
|
||||||
|
@ -218,8 +221,8 @@ static HRESULT WINAPI SystemClockImpl_QueryInterface(IReferenceClock* iface, REF
|
||||||
|
|
||||||
static ULONG WINAPI SystemClockImpl_Release(IReferenceClock* iface) {
|
static ULONG WINAPI SystemClockImpl_Release(IReferenceClock* iface) {
|
||||||
SystemClockImpl *This = (SystemClockImpl *)iface;
|
SystemClockImpl *This = (SystemClockImpl *)iface;
|
||||||
ULONG ref = --This->ref;
|
ULONG ref = InterlockedDecrement(&This->ref);
|
||||||
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
|
TRACE("(%p): ReleaseRef to %ld\n", This, ref);
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
if (SystemClockPostMessageToAdviseThread(This, ADVISE_EXIT)) {
|
if (SystemClockPostMessageToAdviseThread(This, ADVISE_EXIT)) {
|
||||||
WaitForSingleObject(This->adviseThread, INFINITE);
|
WaitForSingleObject(This->adviseThread, INFINITE);
|
||||||
|
|
|
@ -404,19 +404,21 @@ static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID r
|
||||||
static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
|
static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedIncrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
|
||||||
|
|
||||||
return InterlockedIncrement(&This->refCount);
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
|
static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
|
||||||
{
|
{
|
||||||
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
||||||
|
ULONG refCount = InterlockedDecrement(&This->refCount);
|
||||||
|
|
||||||
TRACE("(%p/%p)->() Release from %ld\n", This, iface, This->refCount);
|
TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
|
||||||
|
|
||||||
if (!InterlockedDecrement(&This->refCount))
|
if (!refCount)
|
||||||
{
|
{
|
||||||
DeleteCriticalSection(&This->csFilter);
|
DeleteCriticalSection(&This->csFilter);
|
||||||
IReferenceClock_Release(This->pClock);
|
IReferenceClock_Release(This->pClock);
|
||||||
|
@ -432,7 +434,7 @@ static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return This->refCount;
|
return refCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** IPersist methods **/
|
/** IPersist methods **/
|
||||||
|
|
Loading…
Reference in New Issue