Zebediah Figura : quartz: Immediately return failure from IFilterGraph::RemoveFilter() if IPin::Disconnect() fails.
Alexandre Julliard
julliard at winehq.org
Mon Nov 16 15:28:56 CST 2020
Module: wine
Branch: master
Commit: bd1174e1255f339f13da3fb19f412e7aa43c9ea4
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bd1174e1255f339f13da3fb19f412e7aa43c9ea4
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Sun Nov 15 11:04:37 2020 -0600
quartz: Immediately return failure from IFilterGraph::RemoveFilter() if IPin::Disconnect() fails.
Do not try to stop the filter.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/quartz/filtergraph.c | 44 +++++++++++++++++++----------------------
dlls/quartz/tests/filtergraph.c | 4 ++--
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index 872b355cd35..b3aebabbdad 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -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);
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 7b2aa25a932..e7ee4e5c446 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -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);
More information about the wine-cvs
mailing list