Hi,

while trying to run a demo-app, I had a 'crash'

I have the following (part of a) trace:

trace:d3d:IDirect3DDevice9Impl_GetDepthStencilSurface
(0x77e3d028)->returning ((nil)) default is stencilbuffer=((nil))
trace:seh:EXC_RtlRaiseException code=c0000005 flags=0 addr=0x499db0cd
trace:seh:EXC_RtlRaiseException  info[0]=00000001
trace:seh:EXC_RtlRaiseException  info[1]=00000004
trace:seh:EXC_RtlRaiseException  eax=00000004 ebx=499e232c ecx=00000000
edx=00000001 esi=77e3d028 edi=77ec8318
trace:seh:EXC_RtlRaiseException  ebp=70ecf5ac esp=70ecf5a0 cs=0073
ds=007b es=007b fs=003b gs=0033 flags=00210202

This is because IDirect3DSurface9Impl_AddRef is called with a NULL
parameter. In d3d8/device.c this is checked in d3d9/device.c it isn't.

The demo-app get's a bit further with this patch/hack, but I don't know
if it's correct (or if it is correct in d3d8).

Comments ?

Cheers,

Paul.

Index: dlls/d3d9/device.c
===================================================================
RCS file: /home/wine/wine/dlls/d3d9/device.c,v
retrieving revision 1.20
diff -u -r1.20 device.c
--- dlls/d3d9/device.c	28 Jan 2005 14:03:32 -0000	1.20
+++ dlls/d3d9/device.c	31 Jan 2005 19:26:23 -0000
@@ -359,7 +359,7 @@
     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
     TRACE("(%p)->returning (%p) default is stencilbuffer=(%p)\n", This, This->stencilBufferTarget, This->depthStencilBuffer);
     *ppZStencilSurface = (LPDIRECT3DSURFACE9) This->stencilBufferTarget;
-    IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppZStencilSurface);
+    if (NULL != *ppZStencilSurface) IDirect3DSurface9Impl_AddRef((LPDIRECT3DSURFACE9) *ppZStencilSurface);
     return D3D_OK;
 }
 

Reply via email to