Markus Amsler : d3d8: Test AddRef with refcount==0.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Nov 15 05:37:31 CST 2006


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

Author: Markus Amsler <markus.amsler at oribi.org>
Date:   Wed Nov 15 00:54:17 2006 +0100

d3d8: Test AddRef with refcount==0.

---

 dlls/d3d8/tests/device.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 381eedc..64d3ea8 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -342,8 +342,14 @@ static void test_refcount(void)
         todo_wine CHECK_REFCOUNT( pRenderTarget, 2);
         todo_wine CHECK_RELEASE_REFCOUNT( pRenderTarget, 1);
         todo_wine CHECK_RELEASE_REFCOUNT( pRenderTarget, 0);
+        CHECK_REFCOUNT( pDevice, --refcount);
+
+        /* The render target is released with the device, so AddRef with refcount=0 is fine here. */
+        todo_wine CHECK_ADDREF_REFCOUNT(pRenderTarget, 1);
+        todo_wine CHECK_REFCOUNT(pDevice, ++refcount);
+        todo_wine CHECK_RELEASE_REFCOUNT(pRenderTarget, 0);
+        CHECK_REFCOUNT(pDevice, --refcount);
     }
-    CHECK_REFCOUNT( pDevice, --refcount);
 
     /* Render target and back buffer are identical. */
     hr = IDirect3DDevice8_GetBackBuffer(pDevice, 0, 0, &pBackBuffer);
@@ -371,9 +377,15 @@ static void test_refcount(void)
         todo_wine CHECK_REFCOUNT(pDevice, refcount);
 
         todo_wine CHECK_RELEASE_REFCOUNT( pStencilSurface, 0);
+        CHECK_REFCOUNT( pDevice, --refcount);
+
+        /* The stencil surface is released with the device, so AddRef with refcount=0 is fine here. */
+        todo_wine CHECK_ADDREF_REFCOUNT(pStencilSurface, 1);
+        todo_wine CHECK_REFCOUNT(pDevice, ++refcount);
+        todo_wine CHECK_RELEASE_REFCOUNT(pStencilSurface, 0);
+        CHECK_REFCOUNT(pDevice, --refcount);
         pStencilSurface = NULL;
     }
-    CHECK_REFCOUNT( pDevice, --refcount);
 
     /* Buffers */
     hr = IDirect3DDevice8_CreateIndexBuffer( pDevice, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer );
@@ -482,10 +494,16 @@ static void test_refcount(void)
             todo_wine CHECK_SURFACE_CONTAINER( pBackBuffer, IID_IDirect3DDevice8, pDevice);
             todo_wine CHECK_REFCOUNT( pBackBuffer, 1);
             todo_wine CHECK_RELEASE_REFCOUNT( pBackBuffer, 0);
+            CHECK_REFCOUNT( pDevice, --refcount);
+
+            /* The back buffer is released with the swapchain, so AddRef with refcount=0 is fine here. */
+            todo_wine CHECK_ADDREF_REFCOUNT(pBackBuffer, 1);
+            todo_wine CHECK_REFCOUNT(pDevice, ++refcount);
+            todo_wine CHECK_RELEASE_REFCOUNT(pBackBuffer, 0);
+            CHECK_REFCOUNT(pDevice, --refcount);
             pBackBuffer = NULL;
         }
         CHECK_REFCOUNT( pSwapChain, 1);
-        CHECK_REFCOUNT( pDevice, --refcount);
     }
 
     if(pVertexBuffer)




More information about the wine-cvs mailing list