Changed as suggested by Stefan Dösinger. This fixes a crash in a game called "Autobahnverfolgungsjagd Total" (not in AppDB).
Cheers, Cihan
>From 323eae1df7905ea7d0e187a2eebee8e33337eba8 Mon Sep 17 00:00:00 2001 From: Cihan A <[EMAIL PROTECTED]> Date: Sun, 16 Mar 2008 17:40:29 +0100 Subject: ddraw: Fix refcounting of palettes when loading textures --- dlls/ddraw/texture.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/dlls/ddraw/texture.c b/dlls/ddraw/texture.c index 8835e4e..1541237 100644 --- a/dlls/ddraw/texture.c +++ b/dlls/ddraw/texture.c @@ -301,7 +301,7 @@ IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface, ICOM_THIS_FROM(IDirectDrawSurfaceImpl, IDirect3DTexture2, iface); IDirectDrawSurfaceImpl *src_ptr = ICOM_OBJECT(IDirectDrawSurfaceImpl, IDirect3DTexture2, D3DTexture2); IWineD3DPalette *wine_pal, *wine_pal_src; - IDirectDrawPalette *pal = NULL, *pal_src = NULL; + IDirectDrawPalette *pal, *pal_src; HRESULT ret_value = D3D_OK; TRACE("(%p)->(%p)\n", This, src_ptr); @@ -346,6 +346,10 @@ IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface, return D3DERR_TEXTURE_LOAD_FAILED; } } + else + { + pal = NULL; + } ret_value = IWineD3DSurface_GetPalette(src_ptr->WineD3DSurface, &wine_pal_src); if( ret_value != D3D_OK) @@ -365,6 +369,10 @@ IDirect3DTextureImpl_Load(IDirect3DTexture2 *iface, return D3DERR_TEXTURE_LOAD_FAILED; } } + else + { + pal_src = NULL; + } if (pal_src != NULL) { -- 1.5.4.2