[QUARTZ] Handle End Of Stream notifications

Robert Shearman rob at codeweavers.com
Mon Feb 28 15:31:34 CST 2005


Christian Costa wrote:

>Index: dlls/quartz/dsoundrender.c
>===================================================================
>RCS file: /home/wine/wine/dlls/quartz/dsoundrender.c,v
>retrieving revision 1.6
>diff -u -r1.6 dsoundrender.c
>--- dlls/quartz/dsoundrender.c	6 Jan 2005 19:36:47 -0000	1.6
>+++ dlls/quartz/dsoundrender.c	27 Feb 2005 20:48:17 -0000
>@@ -550,8 +550,8 @@
> 
> static HRESULT WINAPI DSoundRender_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
> {
>-    HRESULT hr;
>     DSoundRenderImpl *This = (DSoundRenderImpl *)iface;
>+    HRESULT hr = S_OK;
> 
>     TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName));
> 
>@@ -563,7 +563,14 @@
>             *This->filterInfo.achName = '\0';
>         This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */
> 
>-	hr = IFilterGraph_QueryInterface(pGraph, &IID_IMediaEventSink, (LPVOID*)&This->pEventSink);
>+        This->pEventSink = NULL;
>+        if (pGraph)
>+        {
>+            /* Cache IMediaEventSink interface w/o increasing filtergraph refcount */
>  
>

I appreciate that this works perfectly fine at the moment, but these 
kind of assumptions can lead to difficult to track memory corruptions, 
so it would be best to avoid caching the object here and querying for it 
when it's needed.

>+            hr = IFilterGraph_QueryInterface(pGraph, &IID_IMediaEventSink, (LPVOID*)&This->pEventSink);
>+            if (SUCCEEDED(hr))
>+                IMediaEventSink_Release(This->pEventSink);
>+        }
>     }
>     LeaveCriticalSection(&This->csFilter); 
>  
>

Rob



More information about the wine-devel mailing list