quartz: Avoid side-effects in asserts.

This commit is contained in:
Thomas Faber 2014-07-26 22:04:29 +02:00 committed by Alexandre Julliard
parent cc45c1373c
commit bab08e690e
2 changed files with 22 additions and 7 deletions

View File

@ -151,6 +151,7 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
PullPin *pin = This->Parser.pInputPin;
IMediaSample *sample = NULL;
HRESULT hr;
ULONG ref;
TRACE("(%p, %u)->()\n", This, streamnumber);
@ -264,7 +265,10 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
hr = IAsyncReader_Request(pin->pReader, sample, streamnumber);
if (FAILED(hr))
assert(IMediaSample_Release(sample) == 0);
{
ref = IMediaSample_Release(sample);
assert(ref == 0);
}
}
else
{
@ -278,7 +282,8 @@ static HRESULT AVISplitter_next_request(AVISplitterImpl *This, DWORD streamnumbe
if (sample)
{
ERR("There should be no sample!\n");
assert(IMediaSample_Release(sample) == 0);
ref = IMediaSample_Release(sample);
assert(ref == 0);
}
}
TRACE("--> %08x\n", hr);
@ -510,8 +515,8 @@ static HRESULT AVISplitter_first_request(LPVOID iface)
static HRESULT AVISplitter_done_process(LPVOID iface)
{
AVISplitterImpl *This = iface;
DWORD x;
ULONG ref;
for (x = 0; x < This->Parser.cStreams; ++x)
{
@ -525,7 +530,10 @@ static HRESULT AVISplitter_done_process(LPVOID iface)
stream->thread = NULL;
if (stream->sample)
assert(IMediaSample_Release(stream->sample) == 0);
{
ref = IMediaSample_Release(stream->sample);
assert(ref == 0);
}
stream->sample = NULL;
ResetEvent(stream->packet_queued);
@ -1219,6 +1227,7 @@ static HRESULT AVISplitter_Flush(LPVOID iface)
{
AVISplitterImpl *This = iface;
DWORD x;
ULONG ref;
TRACE("(%p)->()\n", This);
@ -1227,7 +1236,10 @@ static HRESULT AVISplitter_Flush(LPVOID iface)
StreamData *stream = This->streams + x;
if (stream->sample)
assert(IMediaSample_Release(stream->sample) == 0);
{
ref = IMediaSample_Release(stream->sample);
assert(ref == 0);
}
stream->sample = NULL;
ResetEvent(stream->packet_queued);

View File

@ -170,6 +170,7 @@ void Parser_Destroy(ParserImpl *This)
{
IPin *connected = NULL;
ULONG pinref;
HRESULT hr;
assert(!This->filter.refCount);
PullPin_WaitForStateChange(This->pInputPin, INFINITE);
@ -178,9 +179,11 @@ void Parser_Destroy(ParserImpl *This)
IPin_ConnectedTo(&This->pInputPin->pin.IPin_iface, &connected);
if (connected)
{
assert(IPin_Disconnect(connected) == S_OK);
hr = IPin_Disconnect(connected);
assert(hr == S_OK);
IPin_Release(connected);
assert(IPin_Disconnect(&This->pInputPin->pin.IPin_iface) == S_OK);
hr = IPin_Disconnect(&This->pInputPin->pin.IPin_iface);
assert(hr == S_OK);
}
pinref = IPin_Release(&This->pInputPin->pin.IPin_iface);
if (pinref)