[PATCH] d3d8/tests: Do not crash, when CreateTexture failed

Detlef Riekenberg wine.dev at web.de
Sat Oct 13 18:12:30 CDT 2012


Needed to avoid a crash on an Intel integrated graphics.
http://test.winehq.org/data/ee59341721b90e58165a7bb12cbf2906fbd680d1/xp_dr-xp-sigi/d3d8:device.html

--
By by ... Detlef
---
 dlls/d3d8/tests/device.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 8cd150f..d056266 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -3191,7 +3191,15 @@ static void test_reset_resources(void)
 
     hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_DEPTHSTENCIL,
             D3DFMT_D24S8, D3DPOOL_DEFAULT, &texture);
-    ok(SUCCEEDED(hr), "Failed to create depth/stencil texture, hr %#x.\n", hr);
+
+    if (hr == D3DERR_INVALIDCALL)
+        skip("depth/stencil texture not supported\n");
+    else
+        ok(SUCCEEDED(hr), "Failed to create depth/stencil texture, hr %#x.\n", hr);
+
+    if (!SUCCEEDED(hr))
+            goto release_device;
+
     hr = IDirect3DTexture8_GetSurfaceLevel(texture, 0, &surface);
     ok(SUCCEEDED(hr), "Failed to get surface, hr %#x.\n", hr);
     IDirect3DTexture8_Release(texture);
@@ -3219,6 +3227,7 @@ static void test_reset_resources(void)
     IDirect3DSurface8_Release(surface);
     IDirect3DSurface8_Release(rt);
 
+release_device:
     ref = IDirect3DDevice8_Release(device);
     ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
 
-- 
1.7.5.4




More information about the wine-patches mailing list