[PATCH 20/54] dplayx: Remove AddRef hacks for the parent DirectPlay object.
Michael Stefaniuc
mstefani at redhat.de
Fri Mar 29 10:47:39 CDT 2013
DirectPlay has now a sane ref counting.
---
dlls/dplayx/dplaysp.c | 23 -----------------------
dlls/dplayx/lobbysp.c | 16 ----------------
dlls/dplayx/tests/dplayx.c | 4 ++--
3 files changed, 2 insertions(+), 41 deletions(-)
diff --git a/dlls/dplayx/dplaysp.c b/dlls/dplayx/dplaysp.c
index bd3e2c1..9ce6910 100644
--- a/dlls/dplayx/dplaysp.c
+++ b/dlls/dplayx/dplaysp.c
@@ -173,21 +173,6 @@ static BOOL DPSP_CreateDirectPlaySP( LPVOID lpSP, IDirectPlay2Impl* dp )
This->sp->dplay = dp;
- /* Normally we should be keeping a reference, but since only the dplay
- * interface that created us can destroy us, we do not keep a reference
- * to it (ie we'd be stuck with always having one reference to the dplay
- * object, and hence us, around).
- * NOTE: The dp object does reference count us.
- *
- * FIXME: This is a kludge to get around a problem where a queryinterface
- * is used to get a new interface and then is closed. We will then
- * reference garbage. However, with this we will never deallocate
- * the interface we store. The correct fix is to require all
- * DP internal interfaces to use the This->dp2 interface which
- * should be changed to This->dp
- */
- IDirectPlayX_AddRef( (LPDIRECTPLAY2)dp );
-
return TRUE;
}
@@ -195,14 +180,6 @@ static BOOL DPSP_DestroyDirectPlaySP( LPVOID lpSP )
{
IDirectPlaySPImpl *This = lpSP;
- /* Normally we should be keeping a reference, but since only the dplay
- * interface that created us can destroy us, we do not keep a reference
- * to it (ie we'd be stuck with always having one reference to the dplay
- * object, and hence us, around).
- * NOTE: The dp object does reference count us.
- */
- /*IDirectPlayX_Release( (LPDIRECTPLAY2)This->sp->dplay ); */
-
HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData );
HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData );
diff --git a/dlls/dplayx/lobbysp.c b/dlls/dplayx/lobbysp.c
index 3f545c1..737cb3f 100644
--- a/dlls/dplayx/lobbysp.c
+++ b/dlls/dplayx/lobbysp.c
@@ -148,22 +148,6 @@ static BOOL DPLSP_CreateDPLobbySP( LPVOID lpSP, IDirectPlay2Impl* dp )
This->sp->dplay = dp;
- /* Normally we should be keeping a reference, but since only the dplay
- * interface that created us can destroy us, we do not keep a reference
- * to it (ie we'd be stuck with always having one reference to the dplay
- * object, and hence us, around).
- * NOTE: The dp object does reference count us.
- *
- * FIXME: This is a kludge to get around a problem where a queryinterface
- * is used to get a new interface and then is closed. We will then
- * reference garbage. However, with this we will never deallocate
- * the interface we store. The correct fix is to require all
- * DP internal interfaces to use the This->dp2 interface which
- * should be changed to This->dp
- */
- IDirectPlayX_AddRef( (LPDIRECTPLAY2)dp );
-
-
return TRUE;
}
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c
index c8ec54d..b7bbac3 100644
--- a/dlls/dplayx/tests/dplayx.c
+++ b/dlls/dplayx/tests/dplayx.c
@@ -6394,7 +6394,7 @@ static void test_COM(void)
(void**)&dp4);
ok(hr == S_OK, "DirectPlay create failed: %08x, expected S_OK\n", hr);
refcount = IDirectPlayX_AddRef(dp4);
- todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay2A, (void**)&dp2A);
ok(hr == S_OK, "QueryInterface for IID_IDirectPlay2A failed: %08x\n", hr);
@@ -6441,7 +6441,7 @@ static void test_COM(void)
IDirectPlay2_Release(dp2A);
IDirectPlayX_Release(dp4);
refcount = IDirectPlayX_Release(dp4);
- todo_wine ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
+ ok(refcount == 0, "refcount == %u, expected 0\n", refcount);
}
--
1.7.11.7
More information about the wine-patches
mailing list