From 70bdfdf571287b1e31386e940710a47d7c640f93 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 13 Mar 2008 22:00:57 -0700 Subject: [PATCH] quartz: Fix IFilterGraph2_RemoveFilter to stop the filter before removing it --- dlls/quartz/filtergraph.c | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 7f92562..9973c9c 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -448,12 +448,32 @@ static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, if (This->ppFiltersInGraph[i] == pFilter) { IEnumPins *penumpins; + IBaseFilter_Stop(pFilter); hr = IBaseFilter_EnumPins(pFilter, &penumpins); if (SUCCEEDED(hr)) { IPin *ppin; while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK) { - IPin_Disconnect(ppin); - IPin_Release(ppin); + IPin *victim = NULL; + HRESULT h; + IPin_ConnectedTo(ppin, &victim); + if (victim) + { + h = IPin_Disconnect(victim); + TRACE("Disconnect other side: %08x\n", h); + if (h == VFW_E_NOT_STOPPED) + { + IBaseFilter *vfilter = NULL; + PIN_INFO pinfo; + IPin_QueryPinInfo(victim, &pinfo); + IBaseFilter_Stop(pinfo.pFilter); + IBaseFilter_Release(pinfo.pFilter); + h = IPin_Disconnect(victim); + TRACE("Disconnect retry: %08x\n", h); + } + IPin_Release(victim); + } + h = IPin_Disconnect(ppin); + TRACE("Disconnect 2: %08x\n", h); } IEnumPins_Release(penumpins); } -- 1.5.4.1