Michael Stefaniuc : dsound: Use AddRef to set the refcounts at object creation.

Alexandre Julliard julliard at winehq.org
Mon Jan 16 13:01:29 CST 2012


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Jan 16 00:14:35 2012 +0100

dsound: Use AddRef to set the refcounts at object creation.

---

 dlls/dsound/buffer.c  |    5 +++--
 dlls/dsound/primary.c |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index e2f2cc2..bc9b955 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -900,8 +900,8 @@ HRESULT IDirectSoundBufferImpl_Create(
 
 	TRACE("Created buffer at %p\n", dsb);
 
-	dsb->ref = 1;
-	dsb->numIfaces = 1;
+	dsb->ref = 0;
+	dsb->numIfaces = 0;
 	dsb->device = device;
 	dsb->IDirectSoundBuffer8_iface.lpVtbl = &dsbvt;
 	dsb->iks = NULL;
@@ -1012,6 +1012,7 @@ HRESULT IDirectSoundBufferImpl_Create(
 		}
 	}
 
+        IDirectSoundBuffer8_AddRef(&dsb->IDirectSoundBuffer8_iface);
 	*pdsb = dsb;
 	return err;
 }
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index a629fab..9363a31 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -1218,9 +1218,9 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl *
 		return DSERR_OUTOFMEMORY;
 	}
 
-        dsb->ref = 1;
+        dsb->ref = 0;
         dsb->ref3D = 0;
-        dsb->numIfaces = 1;
+        dsb->numIfaces = 0;
 	dsb->device = device;
 	dsb->IDirectSoundBuffer8_iface.lpVtbl = (IDirectSoundBuffer8Vtbl *)&dspbvt;
         dsb->IDirectSound3DListener_iface.lpVtbl = &ds3dlvt;
@@ -1253,6 +1253,7 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl *
                 device->pwfx->nBlockAlign, device->pwfx->wBitsPerSample,
                 device->pwfx->cbSize);
 
+        IDirectSoundBuffer_AddRef(&dsb->IDirectSoundBuffer8_iface);
 	*ppdsb = dsb;
 	return S_OK;
 }




More information about the wine-cvs mailing list