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

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


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

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

diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 8fd72cf..7943a96 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -3458,7 +3458,15 @@ static void test_reset_resources(void)
 
     hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 1, D3DUSAGE_DEPTHSTENCIL,
             D3DFMT_D24S8, D3DPOOL_DEFAULT, &texture, NULL);
-    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 = IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface);
     ok(SUCCEEDED(hr), "Failed to get surface, hr %#x.\n", hr);
     IDirect3DTexture9_Release(texture);
@@ -3496,6 +3504,7 @@ static void test_reset_resources(void)
         ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
     }
 
+release_device:
     ref = IDirect3DDevice9_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