[PATCH 2/8] Revert "dsound: Remove refcounting in classfactory."
Maarten Lankhorst
m.b.lankhorst at gmail.com
Mon Jan 4 15:37:09 CST 2010
This reverts commit 1b94450f789791908a370f16e125087b84f35bcb.
---
dlls/dsound/dsound_main.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index e7c59e9..f65dbf9 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -497,6 +497,7 @@ typedef HRESULT (*FnCreateInstance)(REFIID riid, LPVOID *ppobj);
typedef struct {
const IClassFactoryVtbl *lpVtbl;
+ LONG ref;
REFCLSID rclsid;
FnCreateInstance pfnCreateInstance;
} IClassFactoryImpl;
@@ -521,13 +522,19 @@ DSCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppobj)
static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface)
{
- return 2;
+ IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+ ULONG ref = InterlockedIncrement(&(This->ref));
+ TRACE("(%p) ref was %d\n", This, ref - 1);
+ return ref;
}
static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface)
{
+ IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+ ULONG ref = InterlockedDecrement(&(This->ref));
+ TRACE("(%p) ref was %d\n", This, ref + 1);
/* static class, won't be freed */
- return 1;
+ return ref;
}
static HRESULT WINAPI DSCF_CreateInstance(
@@ -566,13 +573,13 @@ static const IClassFactoryVtbl DSCF_Vtbl = {
};
static IClassFactoryImpl DSOUND_CF[] = {
- { &DSCF_Vtbl, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
- { &DSCF_Vtbl, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
- { &DSCF_Vtbl, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
- { &DSCF_Vtbl, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
- { &DSCF_Vtbl, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
- { &DSCF_Vtbl, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
- { NULL, NULL, NULL }
+ { &DSCF_Vtbl, 1, &CLSID_DirectSound, (FnCreateInstance)DSOUND_Create },
+ { &DSCF_Vtbl, 1, &CLSID_DirectSound8, (FnCreateInstance)DSOUND_Create8 },
+ { &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture, (FnCreateInstance)DSOUND_CaptureCreate },
+ { &DSCF_Vtbl, 1, &CLSID_DirectSoundCapture8, (FnCreateInstance)DSOUND_CaptureCreate8 },
+ { &DSCF_Vtbl, 1, &CLSID_DirectSoundFullDuplex, (FnCreateInstance)DSOUND_FullDuplexCreate },
+ { &DSCF_Vtbl, 1, &CLSID_DirectSoundPrivate, (FnCreateInstance)IKsPrivatePropertySetImpl_Create },
+ { NULL, 0, NULL, NULL }
};
/*******************************************************************************
--
1.6.5.7
--------------060500030705050501030007--
More information about the wine-patches
mailing list