Alexandre Julliard : ddraw/tests: Properly release surfaces even if we can' t get the texture object.

Alexandre Julliard julliard at winehq.org
Tue Jul 14 10:37:30 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul 14 11:29:02 2009 +0200

ddraw/tests: Properly release surfaces even if we can't get the texture object.

---

 dlls/ddraw/tests/dsurface.c |   62 ++++++++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c
index a73c34c..28fc0f5 100644
--- a/dlls/ddraw/tests/dsurface.c
+++ b/dlls/ddraw/tests/dsurface.c
@@ -1030,36 +1030,38 @@ static void IFaceRefCount(void)
 
     /* IDirect3DTexture interface (unlike the others) alters the original IDirectDrawSurface ref count */
     ret = IDirectDrawSurface_QueryInterface(surf, &IID_IDirect3DTexture, (void **) &tex);
-    if (ret == E_NOINTERFACE) return;  /* win64 */
-    ref = getRefcount((IUnknown *) tex);
-    todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
-    ref = getRefcount((IUnknown *) surf);
-    todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
-
-    IDirectDrawSurface_QueryInterface(surf, &IID_IDirect3DTexture2, (void **) &tex2);
-    ref = getRefcount((IUnknown *) tex);
-    todo_wine ok(ref == 3, "Refcount is %u, expected 3\n", ref);
-    ref = getRefcount((IUnknown *) tex2);
-    todo_wine ok(ref == 3, "Refcount is %u, expected 3\n", ref);
-    ref = getRefcount((IUnknown *) surf);
-    todo_wine ok(ref == 3, "Refcount is %u, expected 3\n", ref);
-
-    IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawGammaControl, (void **) &gamma);
-    ref = getRefcount((IUnknown *) gamma);
-    todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
-
-    ref = IDirect3DTexture2_Release(tex2); /* Release the texture */
-    todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
-    ref = getRefcount((IUnknown *) surf);
-    todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
-
-    ref = IDirect3DTexture_Release(tex); /* Release the texture */
-    todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
-    ref = getRefcount((IUnknown *) surf);
-    todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
-
-    ref = IDirectDrawGammaControl_Release(gamma); /* Release the gamma control */
-    todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref);
+    if (SUCCEEDED(ret))
+    {
+        ref = getRefcount((IUnknown *) tex);
+        todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
+        ref = getRefcount((IUnknown *) surf);
+        todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
+
+        IDirectDrawSurface_QueryInterface(surf, &IID_IDirect3DTexture2, (void **) &tex2);
+        ref = getRefcount((IUnknown *) tex);
+        todo_wine ok(ref == 3, "Refcount is %u, expected 3\n", ref);
+        ref = getRefcount((IUnknown *) tex2);
+        todo_wine ok(ref == 3, "Refcount is %u, expected 3\n", ref);
+        ref = getRefcount((IUnknown *) surf);
+        todo_wine ok(ref == 3, "Refcount is %u, expected 3\n", ref);
+
+        IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawGammaControl, (void **) &gamma);
+        ref = getRefcount((IUnknown *) gamma);
+        todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
+
+        ref = IDirect3DTexture2_Release(tex2); /* Release the texture */
+        todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
+        ref = getRefcount((IUnknown *) surf);
+        todo_wine ok(ref == 2, "Refcount is %u, expected 2\n", ref);
+
+        ref = IDirect3DTexture_Release(tex); /* Release the texture */
+        todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
+        ref = getRefcount((IUnknown *) surf);
+        todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);
+
+        ref = IDirectDrawGammaControl_Release(gamma); /* Release the gamma control */
+        todo_wine ok(ref == 0, "Refcount is %u, expected 0\n", ref);
+    }
 
     ref = IDirectDrawSurface2_Release(surf2); /* Release one of the 2 surf2 interfaces */
     todo_wine ok(ref == 1, "Refcount is %u, expected 1\n", ref);




More information about the wine-cvs mailing list