Michael Stefaniuc : dplayx: IDirectPlay and IUnknown share a refcount.
Alexandre Julliard
julliard at winehq.org
Tue Apr 9 13:41:27 CDT 2013
Module: wine
Branch: master
Commit: 3b7f969a6bd22e062e388d716fb7f7d9d1dba959
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3b7f969a6bd22e062e388d716fb7f7d9d1dba959
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Mon Apr 8 23:19:09 2013 +0200
dplayx: IDirectPlay and IUnknown share a refcount.
---
dlls/dplayx/dplay.c | 2 +-
dlls/dplayx/tests/dplayx.c | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c
index ac39651..c276dba 100644
--- a/dlls/dplayx/dplay.c
+++ b/dlls/dplayx/dplay.c
@@ -643,7 +643,7 @@ static HRESULT WINAPI IDirectPlay4Impl_QueryInterface( IDirectPlay4 *iface, REFI
if ( IsEqualGUID( &IID_IUnknown, riid ) )
{
TRACE( "(%p)->(IID_IUnknown %p)\n", This, ppv );
- *ppv = &This->IDirectPlay4A_iface;
+ *ppv = &This->IDirectPlay_iface;
}
else if ( IsEqualGUID( &IID_IDirectPlay, riid ) )
{
diff --git a/dlls/dplayx/tests/dplayx.c b/dlls/dplayx/tests/dplayx.c
index 619425d..0e7aafb 100644
--- a/dlls/dplayx/tests/dplayx.c
+++ b/dlls/dplayx/tests/dplayx.c
@@ -6367,6 +6367,7 @@ static void test_host_migration(void)
static void test_COM(void)
{
+ IDirectPlay *dp;
IDirectPlay2A *dp2A;
IDirectPlay2 *dp2;
IDirectPlay3A *dp3A;
@@ -6426,14 +6427,22 @@ static void test_COM(void)
ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
IDirectPlayX_Release(dp4A);
+ /* IDirectPlay and IUnknown share a refcount */
+ hr = IDirectPlayX_QueryInterface(dp4, &IID_IDirectPlay, (void**)&dp);
+ ok(hr == S_OK, "QueryInterface for IID_IDirectPlay failed: %08x\n", hr);
+ refcount = IDirectPlayX_AddRef(dp);
+ ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ IDirectPlay_Release(dp);
+
hr = IDirectPlayX_QueryInterface(dp4, &IID_IUnknown, (void**)&unk);
ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr);
refcount = IUnknown_AddRef(unk);
- todo_wine ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
+ ok(refcount == 3, "refcount == %u, expected 3\n", refcount);
refcount = IUnknown_Release(unk);
- todo_wine ok(refcount == 1, "refcount == %u, expected 1\n", refcount);
+ ok(refcount == 2, "refcount == %u, expected 2\n", refcount);
IUnknown_Release(unk);
+ IDirectPlay_Release(dp);
IDirectPlayX_Release(dp4A);
IDirectPlay3_Release(dp3);
IDirectPlay3_Release(dp3A);
More information about the wine-cvs
mailing list