quartz: Release objects when pins fail to connect.
This commit is contained in:
parent
52529c923d
commit
d8dc9fb319
|
@ -79,9 +79,11 @@ static HRESULT OutputPin_ConnectSpecific(IPin * iface, IPin * pReceivePin, const
|
||||||
* connected pin */
|
* connected pin */
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
This->pMemInputPin = NULL;
|
||||||
hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (LPVOID)&This->pMemInputPin);
|
hr = IPin_QueryInterface(pReceivePin, &IID_IMemInputPin, (LPVOID)&This->pMemInputPin);
|
||||||
|
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
|
{
|
||||||
hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pMemAlloc);
|
hr = IMemInputPin_GetAllocator(This->pMemInputPin, &pMemAlloc);
|
||||||
|
|
||||||
if (hr == VFW_E_NO_ALLOCATOR)
|
if (hr == VFW_E_NO_ALLOCATOR)
|
||||||
|
@ -100,11 +102,18 @@ static HRESULT OutputPin_ConnectSpecific(IPin * iface, IPin * pReceivePin, const
|
||||||
|
|
||||||
if (pMemAlloc)
|
if (pMemAlloc)
|
||||||
IMemAllocator_Release(pMemAlloc);
|
IMemAllocator_Release(pMemAlloc);
|
||||||
|
}
|
||||||
|
|
||||||
/* break connection if we couldn't get the allocator */
|
/* break connection if we couldn't get the allocator */
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
if (This->pMemInputPin)
|
||||||
|
IMemInputPin_Release(This->pMemInputPin);
|
||||||
|
This->pMemInputPin = NULL;
|
||||||
|
|
||||||
IPin_Disconnect(pReceivePin);
|
IPin_Disconnect(pReceivePin);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
@ -1069,6 +1078,8 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
This->pReader = NULL;
|
||||||
|
This->pAlloc = NULL;
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
|
hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
|
||||||
|
@ -1095,6 +1106,15 @@ HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const
|
||||||
This->pin.pConnectedTo = pReceivePin;
|
This->pin.pConnectedTo = pReceivePin;
|
||||||
IPin_AddRef(pReceivePin);
|
IPin_AddRef(pReceivePin);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (This->pReader)
|
||||||
|
IAsyncReader_Release(This->pReader);
|
||||||
|
This->pReader = NULL;
|
||||||
|
if (This->pAlloc)
|
||||||
|
IMemAllocator_Release(This->pAlloc);
|
||||||
|
This->pAlloc = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LeaveCriticalSection(This->pin.pCritSec);
|
LeaveCriticalSection(This->pin.pCritSec);
|
||||||
return hr;
|
return hr;
|
||||||
|
|
Loading…
Reference in New Issue