On Sat, Jun 14, 2003 at 08:13:42PM -0400, OverrideX wrote:
> guessing it has to do with how ss2 is calling sounds, since it seems
> directly related to dsound underruns, and dsound_main.c says in the todo
> it's missing critical section locking in some parts of it's code, and

I don't think the missing critical sections in AddRef and Release are 
related to your problem, but just in case, I have changed the AddRef and 
Release in dsound_main.c to use InterlockedIncrement and 
InterlockedDecrement.  Does this help?  Or at least, does it avoid 
breaking it worse?

-- 
John K. Hohm
[EMAIL PROTECTED]
Index: dlls/dsound/dsound_main.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound_main.c,v
retrieving revision 1.83
diff -u -r1.83 dsound_main.c
--- dlls/dsound/dsound_main.c   22 May 2003 03:39:13 -0000      1.83
+++ dlls/dsound/dsound_main.c   18 Jun 2003 00:10:13 -0000
@@ -690,14 +690,14 @@
 static ULONG WINAPI IDirectSoundImpl_AddRef(LPDIRECTSOUND8 iface) {
        ICOM_THIS(IDirectSoundImpl,iface);
        TRACE("(%p) ref was %ld\n", This, This->ref);
-       return ++(This->ref);
+       return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI IDirectSoundImpl_Release(LPDIRECTSOUND8 iface) {
        HRESULT hres;
        ICOM_THIS(IDirectSoundImpl,iface);
        TRACE("(%p), ref was %ld\n",This,This->ref);
-       if (!--(This->ref)) {
+       if (!InterlockedDecrement(&This->ref)) {
                UINT i;
 
                timeKillEvent(This->timerID);
@@ -1090,14 +1090,14 @@
 DSCF_AddRef(LPCLASSFACTORY iface) {
        ICOM_THIS(IClassFactoryImpl,iface);
        TRACE("(%p) ref was %ld\n", This, This->ref);
-       return ++(This->ref);
+       return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) {
        ICOM_THIS(IClassFactoryImpl,iface);
        /* static class, won't be  freed */
        TRACE("(%p) ref was %ld\n", This, This->ref);
-       return --(This->ref);
+       return InterlockedDecrement(&This->ref);
 }
 
 static HRESULT WINAPI DSCF_CreateInstance(

Reply via email to