[PATCH 5/5] dsound: Handle primary buffers in two more IDirectSoundBuffer methods.

Michael Stefaniuc mstefani at redhat.de
Tue Aug 30 18:19:09 CDT 2011


---
 dlls/dsound/buffer.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index 7f1d005..6ba6c24 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -284,6 +284,11 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(IDirectSoundBuffer8 *i
 
 	TRACE("(%p,%d)\n",This,freq);
 
+        if (is_primary_buffer(This)) {
+                WARN("not available for primary buffers.\n");
+                return DSERR_CONTROLUNAVAIL;
+        }
+
 	if (!(This->dsbd.dwFlags & DSBCAPS_CTRLFREQUENCY)) {
 		WARN("control unavailable\n");
 		return DSERR_CONTROLUNAVAIL;
@@ -397,9 +402,12 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(IDirectSoundBuffer8 *iface)
 
     TRACE("(%p) ref was %d\n", This, ref + 1);
 
-    if (!ref && !InterlockedDecrement(&This->numIfaces))
-        secondarybuffer_destroy(This);
-
+    if (!ref && !InterlockedDecrement(&This->numIfaces)) {
+        if (is_primary_buffer(This))
+            primarybuffer_destroy(This);
+        else
+            secondarybuffer_destroy(This);
+    }
     return ref;
 }
 
-- 
1.7.6.1



More information about the wine-patches mailing list