Fix potential race in IPinImpl_ConnectedTo.
This commit is contained in:
parent
c626491bf1
commit
7deab42609
|
@ -247,19 +247,25 @@ HRESULT WINAPI IPinImpl_Disconnect(IPin * iface)
|
||||||
|
|
||||||
HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
|
HRESULT WINAPI IPinImpl_ConnectedTo(IPin * iface, IPin ** ppPin)
|
||||||
{
|
{
|
||||||
|
HRESULT hr;
|
||||||
ICOM_THIS(IPinImpl, iface);
|
ICOM_THIS(IPinImpl, iface);
|
||||||
|
|
||||||
/* TRACE("(%p)\n", ppPin);*/
|
/* TRACE("(%p)\n", ppPin);*/
|
||||||
|
|
||||||
*ppPin = This->pConnectedTo;
|
EnterCriticalSection(This->pCritSec);
|
||||||
|
|
||||||
if (*ppPin)
|
|
||||||
{
|
{
|
||||||
IPin_AddRef(*ppPin);
|
if (This->pConnectedTo)
|
||||||
return S_OK;
|
{
|
||||||
|
*ppPin = This->pConnectedTo;
|
||||||
|
IPin_AddRef(*ppPin);
|
||||||
|
hr = S_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
hr = VFW_E_NOT_CONNECTED;
|
||||||
}
|
}
|
||||||
else
|
LeaveCriticalSection(This->pCritSec);
|
||||||
return VFW_E_NOT_CONNECTED;
|
|
||||||
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt)
|
HRESULT WINAPI IPinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt)
|
||||||
|
|
Loading…
Reference in New Issue