From 857aaee6d6f394eb9dd8dd9a56692cf85bc52581 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Thu, 12 Nov 2009 14:46:06 +1000 Subject: Fix assert on windows when deleting phonon nodes from a running graph. If removing a filter from the direct show graph fails because it is running, stop the graph and try again. Task-number: QTBUG-5011 Reviewed-by: Justin McPherson --- src/3rdparty/phonon/ds9/backendnode.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/phonon/ds9/backendnode.cpp b/src/3rdparty/phonon/ds9/backendnode.cpp index 855357a..3afcafa 100644 --- a/src/3rdparty/phonon/ds9/backendnode.cpp +++ b/src/3rdparty/phonon/ds9/backendnode.cpp @@ -58,7 +58,24 @@ namespace Phonon BackendNode::~BackendNode() { //this will remove the filter from the graph - mediaObjectDestroyed(); + FILTER_INFO info; + for(int i = 0; i < FILTER_COUNT; ++i) { + const Filter &filter = m_filters[i]; + if (!filter) + continue; + filter->QueryFilterInfo(&info); + if (info.pGraph) { + HRESULT hr = info.pGraph->RemoveFilter(filter); + + if (hr == VFW_E_NOT_STOPPED && m_mediaObject) { + m_mediaObject->ensureStopped(); + + hr = info.pGraph->RemoveFilter(filter); + } + Q_ASSERT(SUCCEEDED(hr)); + info.pGraph->Release(); + } + } } void BackendNode::setMediaObject(MediaObject *mo) -- cgit v0.12