=?UTF-8?Q?Andr=C3=A9=20Hentschel=20?=: ddrawex/tests: Don' t crash when IDirectDraw4 query fails.

Alexandre Julliard julliard at winehq.org
Wed Nov 27 14:50:05 CST 2013


Module: wine
Branch: master
Commit: ef6cc1a282ae378009b944792b11aca66bd37122
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ef6cc1a282ae378009b944792b11aca66bd37122

Author: André Hentschel <nerv at dawncrow.de>
Date:   Tue Nov 26 23:49:03 2013 +0100

ddrawex/tests: Don't crash when IDirectDraw4 query fails.

---

 dlls/ddrawex/tests/ddrawex.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/dlls/ddrawex/tests/ddrawex.c b/dlls/ddrawex/tests/ddrawex.c
index aa31b2f..7134a04 100644
--- a/dlls/ddrawex/tests/ddrawex.c
+++ b/dlls/ddrawex/tests/ddrawex.c
@@ -50,6 +50,7 @@ static void RefCountTest(void)
     IDirectDraw2 *dd2;
     IDirectDraw3 *dd3;
     IDirectDraw4 *dd4;
+    HRESULT hr;
     ULONG ref;
 
     ref = get_ref((IUnknown *) dd1);
@@ -76,7 +77,15 @@ static void RefCountTest(void)
     ref = get_ref((IUnknown *) dd3);
     ok(ref == 3, "IDirectDraw3 refcount is %u, expected 3\n", ref);
 
-    IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw4, (void **) &dd4);
+    hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw4, (void **) &dd4);
+    if (FAILED(hr))
+    {
+        win_skip("Failed to query IDirectDraw4\n");
+        IDirectDraw_Release(dd1);
+        IDirectDraw2_Release(dd2);
+        IDirectDraw3_Release(dd3);
+        return;
+    }
     ref = get_ref((IUnknown *) dd4);
     ok(ref == 4, "IDirectDraw4 refcount is %u, expected 4\n", ref);
 




More information about the wine-cvs mailing list