Commit bd1174e1 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz: Immediately return failure from IFilterGraph::RemoveFilter() if IPin::Disconnect() fails.

Do not try to stop the filter. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent be1ccdf7
......@@ -704,14 +704,11 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte
TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
/* FIXME: check graph is stopped */
LIST_FOR_EACH_ENTRY(entry, &This->filters, struct filter, entry)
{
if (entry->filter == pFilter)
{
IEnumPins *penumpins = NULL;
FILTER_STATE state;
if (This->defaultclock && This->refClockProvider == pFilter)
{
......@@ -726,31 +723,30 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilte
IPin *ppin;
while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK)
{
IPin *victim = NULL;
HRESULT h;
IPin_ConnectedTo(ppin, &victim);
if (victim)
IPin *peer = NULL;
HRESULT hr;
IPin_ConnectedTo(ppin, &peer);
if (peer)
{
h = IPin_Disconnect(victim);
TRACE("Disconnect other side: %08x\n", h);
if (h == VFW_E_NOT_STOPPED)
if (FAILED(hr = IPin_Disconnect(peer)))
{
PIN_INFO pinfo;
IPin_QueryPinInfo(victim, &pinfo);
IBaseFilter_GetState(pinfo.pFilter, 0, &state);
if (state == State_Running)
IBaseFilter_Pause(pinfo.pFilter);
IBaseFilter_Stop(pinfo.pFilter);
IBaseFilter_Release(pinfo.pFilter);
h = IPin_Disconnect(victim);
TRACE("Disconnect retry: %08x\n", h);
WARN("Failed to disconnect peer %p, hr %#x.\n", peer, hr);
IPin_Release(peer);
IPin_Release(ppin);
IEnumPins_Release(penumpins);
return hr;
}
IPin_Release(victim);
}
h = IPin_Disconnect(ppin);
TRACE("Disconnect 2: %08x\n", h);
IPin_Release(peer);
if (FAILED(hr = IPin_Disconnect(ppin)))
{
WARN("Failed to disconnect pin %p, hr %#x.\n", ppin, hr);
IPin_Release(ppin);
IEnumPins_Release(penumpins);
return hr;
}
}
IPin_Release(ppin);
}
IEnumPins_Release(penumpins);
......
......@@ -3130,7 +3130,7 @@ todo_wine
source_pin.require_stopped_disconnect = TRUE;
hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
todo_wine ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(!sink_pin.peer, "Got peer %p.\n", sink_pin.peer);
......@@ -3139,7 +3139,7 @@ todo_wine
source_pin.require_stopped_disconnect = FALSE;
sink_pin.require_stopped_disconnect = TRUE;
hr = IFilterGraph2_RemoveFilter(graph, &source.IBaseFilter_iface);
todo_wine ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(hr == VFW_E_NOT_STOPPED, "Got hr %#x.\n", hr);
ok(source_pin.peer == &sink_pin.IPin_iface, "Got peer %p.\n", source_pin.peer);
ok(sink_pin.peer == &source_pin.IPin_iface, "Got peer %p.\n", sink_pin.peer);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment