Stefan Dösinger stefandoesinger@gmx.at writes:
From 05154939b9123ff44c9e3ec0417c31ccba2a8716 Mon Sep 17 00:00:00 2001 From: Stefan Doesinger stefan@codeweavers.com Date: Mon, 16 Jul 2007 19:49:34 +0200 Subject: [PATCH] WineD3D: Allocate render target management members in Init3D
GL_LIMITS() is not always available in CreateDevice, thus the alloc code has to be in Init3D. To avoid memory leaks and keep things consistent the free calls are moved from Release to Uninit3D.
../../../tools/runtest -q -P wine -M ddraw.dll -T ../../.. -p ddraw_test.exe.so d3d.c && touch d3d.ok wine: Unhandled page fault on read access to 0x00000000 at address 0x61bf2a2c (thread 0019), starting debugger... WineDbg starting on pid 0017 Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x61bf2a2c). Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:61bf2a2c ESP:0033fa10 EBP:0033fa58 EFLAGS:00010246( - 00 -RIZP1) EAX:00000000 EBX:61c8c8d8 ECX:001e8678 EDX:61c8d600 ESI:00000000 EDI:001e8678 Stack dump: 0x0033fa10: 001e8678 00000000 00000000 60917764 0x0033fa20: 00000000 00110000 00000002 61c696e1 0x0033fa30: 00001302 00340020 00000000 00000000 0x0033fa40: 00000000 00000000 61bf281b 61c8c8d8 0x0033fa50: 001e86a0 001e8678 0033fa88 61c1cbb0 0x0033fa60: 0015f1a0 001e8678 00340020 61c37ff8 Backtrace: =>1 0x61bf2a2c IWineD3DDeviceImpl_ResourceReleased+0x21c(iface=0x15f1a0, resource=0x1e8678) [/home/julliard/wine/wine/dlls/wined3d/device.c:6456] in wined3d (0x0033fa58) 2 0x61c1cbb0 IWineD3DResourceImpl_CleanUp+0x100(iface=<register EDI not in topmost frame>) [/home/julliard/wine/wine/dlls/wined3d/resource.c:89] in wined3d (0x0033fa88) 3 0x61c4109f IWineD3DSurfaceImpl_Release+0xbf(iface=0x1e8678) [/home/julliard/wine/wine/dlls/wined3d/surface.c:414] in wined3d (0x0033fac8) 4 0x6072e685 IDirectDrawSurfaceImpl_Destroy+0xe5(This=<register ESI not in topmost frame>) [/home/julliard/wine/wine/dlls/ddraw/surface.c:229] in ddraw (0x0033faf8) 5 0x6072e953 IDirectDrawSurfaceImpl_Release+0x133(iface=0x1e8580) [/home/julliard/wine/wine/dlls/ddraw/surface.c:425] in ddraw (0x0033fb48) 6 0x6072e37d IDirectDrawSurfaceImpl_DeleteAttachedSurface+0xfd(iface=0x19f6f0, Flags=0x0, Attach=<register ESI not in topmost frame>) [/home/julliard/wine/wine/dlls/ddraw/surface.c:991] in ddraw (0x0033fb78) 7 0x6072e664 IDirectDrawSurfaceImpl_Destroy+0xc4(This=<register ESI not in topmost frame>) [/home/julliard/wine/wine/dlls/ddraw/surface.c:220] in ddraw (0x0033fba8) 8 0x6072e953 IDirectDrawSurfaceImpl_Release+0x133(iface=0x19f6f0) [/home/julliard/wine/wine/dlls/ddraw/surface.c:425] in ddraw (0x0033fbf8) 9 0x606db585 func_d3d+0x1ab5() [/home/julliard/wine/wine/dlls/ddraw/tests/d3d.c:151] in ddraw_test (0x0033fe58) 10 0x606ed9c8 run_test+0x128(name=0x1103b6) [/home/julliard/wine/wine/dlls/ddraw/tests/../../../include/wine/test.h:389] in ddraw_test (0x0033fea8) 11 0x606ee05d main+0x14d(argc=<register ECX not in topmost frame>, argv=<register ECX not in topmost frame>) [/home/julliard/wine/wine/dlls/ddraw/tests/../../../include/wine/test.h:437] in ddraw_test (0x0033fed8) 12 0x606ee12b __wine_spec_exe_entry+0x5b(peb=0x7ffdf000) [/home/julliard/wine/wine/dlls/winecrt0/exe_entry.c:36] in ddraw_test (0x0033ff08) 13 0x6041059e start_process+0xee(arg=0x0) [/home/julliard/wine/wine/dlls/kernel32/process.c:820] in kernel32 (0x0033ffe8) 14 0x60027af7 wine_switch_to_stack+0x17() in libwine.so.1 (0x00000000) 0x61bf2a2c IWineD3DDeviceImpl_ResourceReleased+0x21c [/home/julliard/wine/wine/dlls/wined3d/device.c:6456] in wined3d: cmpl 0x0(%eax,%esi,4),%ecx 6456 if (This->fbo_color_attachments[i] == (IWineD3DSurface *)resource) {