Module: wine Branch: master Commit: 14ba79ec621bf60855016297cded61cc865daf5a URL: http://source.winehq.org/git/wine.git/?a=commit;h=14ba79ec621bf60855016297cd...
Author: Maarten Lankhorst m.b.lankhorst@gmail.com Date: Thu Mar 13 22:00:57 2008 -0700
quartz: Fix IFilterGraph RemoveFilter to stop the filter before removing it.
Also checks for VFW_E_NOT_STOPPED that is allowed to cause a disconnection to fail.
---
dlls/quartz/filtergraph.c | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 7f92562..762e3e2 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -448,12 +448,31 @@ 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) + { + 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); }