From 0d8e6719d524ad7bbaf616dff90a1ed6ca15937b Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 30 Jan 2012 21:19:48 +0100 Subject: [PATCH] ddraw: AddAttachedSurface() just references whatever we pass it. --- dlls/ddraw/surface.c | 16 ++++++++-------- dlls/ddraw/tests/ddraw1.c | 4 +++- dlls/ddraw/tests/ddraw2.c | 4 +++- dlls/ddraw/tests/ddraw4.c | 4 +++- dlls/ddraw/tests/ddraw7.c | 4 +++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index f4a4d561523..ced64a9911e 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -1605,8 +1605,8 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa { return hr; } - ddraw_surface7_AddRef(&attachment_impl->IDirectDrawSurface7_iface); attachment_impl->attached_iface = (IUnknown *)attachment; + IUnknown_AddRef(attachment_impl->attached_iface); return hr; } @@ -1624,9 +1624,9 @@ static HRESULT WINAPI ddraw_surface4_AddAttachedSurface(IDirectDrawSurface4 *ifa { return hr; } - ddraw_surface4_AddRef(&attachment_impl->IDirectDrawSurface4_iface); - ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface); attachment_impl->attached_iface = (IUnknown *)attachment; + IUnknown_AddRef(attachment_impl->attached_iface); + ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface); return hr; } static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment) @@ -1670,8 +1670,8 @@ static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *ifa { return hr; } - ddraw_surface3_AddRef(&attachment_impl->IDirectDrawSurface3_iface); attachment_impl->attached_iface = (IUnknown *)attachment; + IUnknown_AddRef(attachment_impl->attached_iface); return hr; } @@ -1689,9 +1689,9 @@ static HRESULT WINAPI ddraw_surface2_AddAttachedSurface(IDirectDrawSurface2 *ifa { return hr; } - ddraw_surface2_AddRef(&attachment_impl->IDirectDrawSurface2_iface); - ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); attachment_impl->attached_iface = (IUnknown *)attachment; + IUnknown_AddRef(attachment_impl->attached_iface); + ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); return hr; } @@ -1709,9 +1709,9 @@ static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *ifac { return hr; } - ddraw_surface1_AddRef(&attachment_impl->IDirectDrawSurface_iface); - ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); attachment_impl->attached_iface = (IUnknown *)attachment; + IUnknown_AddRef(attachment_impl->attached_iface); + ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface); return hr; } diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 35425647727..233d013f27a 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -662,6 +662,7 @@ static void test_surface_interface_mismatch(void) IDirect3DMaterial *background = NULL; DDSURFACEDESC surface_desc; DWORD z_depth = 0; + ULONG refcount; HRESULT hr; D3DCOLOR color; HWND window; @@ -728,7 +729,8 @@ static void test_surface_interface_mismatch(void) /* Using a different surface interface version still works */ hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds); ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface_Release(ds); + refcount = IDirectDrawSurface_Release(ds); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); if (FAILED(hr)) goto cleanup; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 5fa602851a0..3a62f57fe0d 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -687,6 +687,7 @@ static void test_surface_interface_mismatch(void) IDirect3DMaterial2 *background = NULL; DDSURFACEDESC surface_desc; DWORD z_depth = 0; + ULONG refcount; HRESULT hr; D3DCOLOR color; HWND window; @@ -753,7 +754,8 @@ static void test_surface_interface_mismatch(void) /* Using a different surface interface version still works */ hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds); ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface_Release(ds); + refcount = IDirectDrawSurface_Release(ds); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); if (FAILED(hr)) goto cleanup; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 34cab7f49ab..b242f86f14a 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -875,6 +875,7 @@ static void test_surface_interface_mismatch(void) IDirect3DViewport3 *viewport = NULL; DDSURFACEDESC2 surface_desc; DDPIXELFORMAT z_fmt; + ULONG refcount; HRESULT hr; D3DCOLOR color; HWND window; @@ -936,7 +937,8 @@ static void test_surface_interface_mismatch(void) /* Using a different surface interface version still works */ hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds); ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface4_Release(ds); + refcount = IDirectDrawSurface4_Release(ds); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); if (FAILED(hr)) goto cleanup; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 8eb70984bd4..0460a3f4b21 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -841,6 +841,7 @@ static void test_surface_interface_mismatch(void) IDirect3DDevice7 *device = NULL; DDSURFACEDESC2 surface_desc; DDPIXELFORMAT z_fmt; + ULONG refcount; HRESULT hr; D3DCOLOR color; HWND window; @@ -900,7 +901,8 @@ static void test_surface_interface_mismatch(void) /* Using a different surface interface version still works */ hr = IDirectDrawSurface3_AddAttachedSurface(surface3, (IDirectDrawSurface3 *)ds); ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface7_Release(ds); + refcount = IDirectDrawSurface7_Release(ds); + ok(refcount == 1, "Got unexpected refcount %u.\n", refcount); if (FAILED(hr)) goto cleanup;