This fixes a crash in a game called "Autobahnverfolgungsjagd Total"
(not in AppDB).
While tracing this bug I noticed that
IWineD3DBaseSurfaceImpl_GetPalette() does not call AddRef when
returning the palette. Is that intentional?
Cheers,
Cihan
>From ede1c99159606486f7455e5ac3d81049dc135737 Mon Sep 17 00:00:00 2001
From: Cihan Altinay <[EMAIL PROTECTED]>
Date: Sun, 16 Mar 2008 14:25:27 +0100
Subject: ddraw: Fix refcounting of palettes
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