[vlc-commits] bda/dshow: RemoveFilter does an undocumented Release but does not set filter to NULL.

John Freed git at videolan.org
Thu Mar 22 18:07:13 CET 2012


vlc/vlc-1.1 | branch: master | John Freed <okvlc at johnfreed.com> | Wed Mar 21 12:13:52 2012 +0100| [1f6ec58ab8d7f0779b781835ccc9279584dc9622] | committer: Jean-Baptiste Kempf

bda/dshow: RemoveFilter does an undocumented Release but does not set filter to NULL.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=1f6ec58ab8d7f0779b781835ccc9279584dc9622
---

 modules/access/bda/bdagraph.cpp |   11 +++++------
 modules/access/dshow/dshow.cpp  |   10 +++++-----
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/modules/access/bda/bdagraph.cpp b/modules/access/bda/bdagraph.cpp
index 1a19c7c..9b5bcf2 100644
--- a/modules/access/bda/bdagraph.cpp
+++ b/modules/access/bda/bdagraph.cpp
@@ -1570,7 +1570,10 @@ HRESULT BDAGraph::FindFilter( REFCLSID clsid, long* i_moniker_used,
             return S_OK;
         }
         /* Not the filter we want so unload and try the next one */
+        /* Warning: RemoveFilter does an undocumented Release()
+         * on pointer but does not set it to NULL */
         hr = p_filter_graph->RemoveFilter( l.p_filter );
+        l.p_filter = NULL;
         if( FAILED( hr ) )
         {
             msg_Warn( p_access, "FindFilter: "\
@@ -1847,32 +1850,29 @@ HRESULT BDAGraph::Destroy()
 
     if( p_transport_info )
     {
+        /* Warning: RemoveFilter does an undocumented Release()
+         * on pointer but does not set it to NULL */
         p_filter_graph->RemoveFilter( p_transport_info );
-        p_transport_info->Release();
         p_transport_info = NULL;
     }
     if( p_mpeg_demux )
     {
         p_filter_graph->RemoveFilter( p_mpeg_demux );
-        p_mpeg_demux->Release();
         p_mpeg_demux = NULL;
     }
     if( p_sample_grabber )
     {
         p_filter_graph->RemoveFilter( p_sample_grabber );
-        p_sample_grabber->Release();
         p_sample_grabber = NULL;
     }
     if( p_capture_device )
     {
         p_filter_graph->RemoveFilter( p_capture_device );
-        p_capture_device->Release();
         p_capture_device = NULL;
     }
     if( p_tuner_device )
     {
         p_filter_graph->RemoveFilter( p_tuner_device );
-        p_tuner_device->Release();
         p_tuner_device = NULL;
     }
     if( p_scanning_tuner )
@@ -1883,7 +1883,6 @@ HRESULT BDAGraph::Destroy()
     if( p_network_provider )
     {
         p_filter_graph->RemoveFilter( p_network_provider );
-        p_network_provider->Release();
         p_network_provider = NULL;
     }
 
diff --git a/modules/access/dshow/dshow.cpp b/modules/access/dshow/dshow.cpp
index a85ab5e..c6e8916 100644
--- a/modules/access/dshow/dshow.cpp
+++ b/modules/access/dshow/dshow.cpp
@@ -331,8 +331,8 @@ static void DeleteDirectShowGraph( access_sys_t *p_sys )
     {
         p_sys->p_graph->RemoveFilter( p_sys->pp_streams[i]->p_capture_filter );
         p_sys->p_graph->RemoveFilter( p_sys->pp_streams[i]->p_device_filter );
-        p_sys->pp_streams[i]->p_capture_filter->Release();
-        p_sys->pp_streams[i]->p_device_filter->Release();
+        p_sys->pp_streams[i]->p_capture_filter = NULL;
+        p_sys->pp_streams[i]->p_device_filter = NULL;
     }
 
     /* Release directshow objects */
@@ -1148,9 +1148,9 @@ static int OpenDevice( vlc_object_t *p_this, access_sys_t *p_sys,
     p_sys->p_graph->RemoveFilter( p_device_filter );
     p_sys->p_graph->RemoveFilter( p_capture_filter );
 
-    /* Release objects */
-    p_device_filter->Release();
-    p_capture_filter->Release();
+    /* Nullify objects */
+    p_device_filter = NULL;
+    p_capture_filter = NULL;
 
     return VLC_EGENERIC;
 }



More information about the vlc-commits mailing list