src/3rdparty/phonon/ds9/backendnode.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
--- a/src/3rdparty/phonon/ds9/backendnode.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/3rdparty/phonon/ds9/backendnode.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -58,7 +58,24 @@
         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)