mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 12:23:25 +00:00
[QUARTZ][STRMBASE]
- Fix use-after-free on critical sections, which caused test hangs. Also fix some memory leaks. More fixes coming with the next Wine-sync, but this should be enough to get tests working. ROSTESTS-116 svn path=/trunk/; revision=63757
This commit is contained in:
@@ -113,6 +113,7 @@ static ULONG WINAPI IEnumFiltersImpl_Release(IEnumFilters * iface)
|
||||
if (!refCount)
|
||||
{
|
||||
IGraphVersion_Release(This->pVersionSource);
|
||||
CoTaskMemFree(This);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -465,7 +465,7 @@ static HRESULT WINAPI AsyncReader_QueryInterface(IBaseFilter * iface, REFIID rii
|
||||
static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
|
||||
{
|
||||
AsyncReader *This = impl_from_IBaseFilter(iface);
|
||||
ULONG refCount = BaseFilterImpl_Release(iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
|
||||
|
||||
TRACE("(%p)->() Release from %d\n", This, refCount + 1);
|
||||
|
||||
@@ -485,6 +485,7 @@ static ULONG WINAPI AsyncReader_Release(IBaseFilter * iface)
|
||||
CoTaskMemFree(This->pszFileName);
|
||||
if (This->pmt)
|
||||
FreeMediaType(This->pmt);
|
||||
BaseFilter_Destroy(&This->filter);
|
||||
CoTaskMemFree(This);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ static ULONG WINAPI NullRendererInner_AddRef(IUnknown *iface)
|
||||
static ULONG WINAPI NullRendererInner_Release(IUnknown *iface)
|
||||
{
|
||||
NullRendererImpl *This = impl_from_IUnknown(iface);
|
||||
ULONG refCount = BaseFilterImpl_Release(&This->renderer.filter.IBaseFilter_iface);
|
||||
ULONG refCount = BaseRendererImpl_Release(&This->renderer.filter.IBaseFilter_iface);
|
||||
|
||||
if (!refCount)
|
||||
{
|
||||
|
||||
@@ -180,6 +180,7 @@ void Parser_Destroy(ParserImpl *This)
|
||||
}
|
||||
|
||||
CoTaskMemFree(This->ppPins);
|
||||
BaseFilter_Destroy(&This->filter);
|
||||
|
||||
TRACE("Destroying parser\n");
|
||||
CoTaskMemFree(This);
|
||||
@@ -188,7 +189,7 @@ void Parser_Destroy(ParserImpl *This)
|
||||
ULONG WINAPI Parser_Release(IBaseFilter * iface)
|
||||
{
|
||||
ParserImpl *This = impl_from_IBaseFilter(iface);
|
||||
ULONG refCount = BaseFilterImpl_Release(iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
|
||||
|
||||
TRACE("(%p)->() Release from %d\n", This, refCount + 1);
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@ LONG WINAPI BaseFilterImpl_GetPinVersion(BaseFilter* This);
|
||||
VOID WINAPI BaseFilterImpl_IncrementPinVersion(BaseFilter* This);
|
||||
|
||||
HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, const CLSID *pClsid, DWORD_PTR DebugInfo, const BaseFilterFuncTable* pBaseFuncsTable);
|
||||
HRESULT WINAPI BaseFilter_Destroy(BaseFilter * This);
|
||||
|
||||
/* Enums */
|
||||
HRESULT WINAPI EnumMediaTypes_Construct(BasePin *iface, BasePin_GetMediaType enumFunc, BasePin_GetMediaTypeVersion versionFunc, IEnumMediaTypes ** ppEnum);
|
||||
|
||||
+13
-8
@@ -60,14 +60,7 @@ ULONG WINAPI BaseFilterImpl_Release(IBaseFilter * iface)
|
||||
TRACE("(%p)->() Release from %d\n", This, refCount + 1);
|
||||
|
||||
if (!refCount)
|
||||
{
|
||||
if (This->pClock)
|
||||
IReferenceClock_Release(This->pClock);
|
||||
|
||||
This->IBaseFilter_iface.lpVtbl = NULL;
|
||||
This->csFilter.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->csFilter);
|
||||
}
|
||||
BaseFilter_Destroy(This);
|
||||
|
||||
return refCount;
|
||||
}
|
||||
@@ -209,3 +202,15 @@ HRESULT WINAPI BaseFilter_Init(BaseFilter * This, const IBaseFilterVtbl *Vtbl, c
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI BaseFilter_Destroy(BaseFilter * This)
|
||||
{
|
||||
if (This->pClock)
|
||||
IReferenceClock_Release(This->pClock);
|
||||
|
||||
This->IBaseFilter_iface.lpVtbl = NULL;
|
||||
This->csFilter.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&This->csFilter);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
+2
-1
@@ -284,7 +284,7 @@ HRESULT WINAPI BaseRendererImpl_QueryInterface(IBaseFilter* iface, REFIID riid,
|
||||
ULONG WINAPI BaseRendererImpl_Release(IBaseFilter* iface)
|
||||
{
|
||||
BaseRenderer *This = impl_from_IBaseFilter(iface);
|
||||
ULONG refCount = BaseFilterImpl_Release(iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
|
||||
|
||||
if (!refCount)
|
||||
{
|
||||
@@ -309,6 +309,7 @@ ULONG WINAPI BaseRendererImpl_Release(IBaseFilter* iface)
|
||||
CloseHandle(This->ThreadSignal);
|
||||
CloseHandle(This->RenderEvent);
|
||||
QualityControlImpl_Destroy(This->qcimpl);
|
||||
BaseFilter_Destroy(&This->filter);
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
+2
-1
@@ -295,7 +295,7 @@ HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter * iface, REFIID ri
|
||||
ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface)
|
||||
{
|
||||
TransformFilter *This = impl_from_IBaseFilter(iface);
|
||||
ULONG refCount = BaseFilterImpl_Release(iface);
|
||||
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
|
||||
|
||||
TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
|
||||
|
||||
@@ -325,6 +325,7 @@ ULONG WINAPI TransformFilterImpl_Release(IBaseFilter * iface)
|
||||
FreeMediaType(&This->pmt);
|
||||
QualityControlImpl_Destroy(This->qcimpl);
|
||||
IUnknown_Release(This->seekthru_unk);
|
||||
BaseFilter_Destroy(&This->filter);
|
||||
CoTaskMemFree(This);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user