ddraw: Fix refcounting of palettes

Cihan Altinay cia at koala
Sun Mar 16 08:25:27 CDT 2008


This patch prevents releasing the same palettes more than once if main
surfaces have a palette while sub-surfaces haven't.

---
 dlls/ddraw/texture.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/texture.c b/dlls/ddraw/texture.c
index 8835e4e..551e3b2 100644
--- a/dlls/ddraw/texture.c
+++ b/dlls/ddraw/texture.c
@@ -380,8 +380,16 @@ IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface,
             IDirectDrawPalette_SetEntries(pal, 0, 0, 256, palent);
         }
 
-        if (pal) IDirectDrawPalette_Release(pal);
-        if (pal_src) IDirectDrawPalette_Release(pal_src);
+        if (pal)
+        {
+            IDirectDrawPalette_Release(pal);
+            pal = NULL;
+        }
+        if (pal_src)
+        {
+            IDirectDrawPalette_Release(pal_src);
+            pal_src = NULL;
+        }
 
         /* Copy one surface on the other */
         dst_d = (DDSURFACEDESC *)&(This->surface_desc);
-- 
1.5.4.2


--------------070206050602010305060400--



More information about the wine-devel mailing list