DDRAW: Fix reference counting

Robert Shearman rob at codeweavers.com
Sun Sep 18 22:59:11 CDT 2005


Stefan Dösinger wrote:

>Hello,
>This patch increases the reference count of a DirectDraw object when a Surface 
>is created, like Windows does. It also adds a test which tests this 
>functionality.
>
>Stefan Dösinger
>  
>
>------------------------------------------------------------------------
>
>Index: dlls/ddraw/ddraw_main.c
>===================================================================
>RCS file: /home/wine/wine/dlls/ddraw/ddraw_main.c,v
>retrieving revision 1.9
>diff -u -r1.9 ddraw_main.c
>--- dlls/ddraw/ddraw_main.c	12 Sep 2005 14:12:47 -0000	1.9
>+++ dlls/ddraw/ddraw_main.c	18 Sep 2005 19:56:12 -0000
>@@ -697,8 +697,10 @@
>     }
>     else if (pDDSD->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
>     {
>-	/* create texture */
>+	/* create texture. This increases the DD refcount by 2 */
>  
>

Why do you increase the refcount by 2? Since you add and release them in 
the same functions, it is not really necessary and just adds complexity 
to the code.

> 	hr = create_texture(This, pDDSD, ppSurf, pUnkOuter);
>+	if(!FAILED(hr))
>+		IDirectDraw7_AddRef(iface); /* Plus the increase at the end of the function */
>  
>

if (!FAILED(hr)) -> if (SUCCEEDED(hr))


-- 
Rob Shearman




More information about the wine-devel mailing list