DDraw: Don't destroy complex attached surfaces even if explicitely requested as they will be liquidated anyway when the root is destroyed.

Elie Morisse lachienne at wanadoo.fr
Fri Sep 22 09:55:39 CDT 2006


A new version of my refcounting patch, lighter and honoring Stefan Dösinger proposal.

-------------- next part --------------
>From 6358da46f68fcce30d8ad37041d8b1832724ea2f Mon Sep 17 00:00:00 2001
From: Elie Morisse <lachienne at wanadoo.fr>
Date: Fri, 22 Sep 2006 18:24:05 +0400
Subject: [PATCH] ddraw: Don't destroy complex attached surfaces even if explicitely requested as they will be liquidated anyway when the root is destroyed.

This prevent memory faults.
---
 dlls/ddraw/surface.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 74987bf..111fa9e 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -293,14 +293,11 @@ IDirectDrawSurfaceImpl_Release(IDirectDr
         IDirectDrawImpl *ddraw;
         IUnknown *ifaceToRelease = This->ifaceToRelease;
 
-        /* Destroy all complex attached surfaces
-         * Therefore, start with the first surface,
-         * except for textures. Not entirely sure what has
-         * to happen exactly in this case
-         */
-        if( (This->first_complex != This) && !(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_TEXTURE))
+        /* Complex attached surfaces are destroyed implicitely when the root is released */
+        if(This->first_complex != This)
         {
-            FIXME("(%p) Destroying a surface which is a attached to a complex root %p\n", This, This->first_complex);
+            WARN("(%p) Attempt to destroy a surface that is attached to a complex root %p\n", This, This->first_complex);
+            return ref;
         }
         ddraw = This->ddraw;
 
-- 
1.4.2.1



More information about the wine-patches mailing list