winejack.drv: Add DebugInfo to critical sections

Jan Zerebecki jan.wine at zerebecki.de
Mon Apr 16 02:56:16 CDT 2007


and avoid it's double delete.
---
If this patch is rejected from inclusion, please tell me why, as
I would have to ask anyway.

 dlls/winejack.drv/audio.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/dlls/winejack.drv/audio.c b/dlls/winejack.drv/audio.c
index 7cba9a5..dca5054 100644
--- a/dlls/winejack.drv/audio.c
+++ b/dlls/winejack.drv/audio.c
@@ -856,7 +856,14 @@ LONG	JACK_WaveRelease(void)
 #else
       JACK_CloseWaveOutDevice(&WOutDev[iDevice]); /* close the device, FORCE the client to close */
 #endif
-      DeleteCriticalSection(&(WOutDev[iDevice].access_crst)); /* delete the critical section */
+#if JACK_CLOSE_HACK
+      if(WOutDev[iDevice].in_use) {
+#endif
+        WOutDev[iDevice].access_crst.DebugInfo->Spare[0] = 0;
+        DeleteCriticalSection(&(WOutDev[iDevice].access_crst)); /* delete the critical section */
+#if JACK_CLOSE_HACK
+      }
+#endif
     }
   }
 
@@ -873,7 +880,14 @@ LONG	JACK_WaveRelease(void)
 #else
       JACK_CloseWaveInDevice(&WInDev[iDevice]); /* close the device, FORCE the client to close */
 #endif
-      DeleteCriticalSection(&(WInDev[iDevice].access_crst)); /* delete the critical section */
+#if JACK_CLOSE_HACK
+      if(WOutDev[iDevice].in_use) {
+#endif
+        WInDev[iDevice].access_crst.DebugInfo->Spare[0] = 0;
+        DeleteCriticalSection(&(WInDev[iDevice].access_crst)); /* delete the critical section */
+#if JACK_CLOSE_HACK
+      }
+#endif
     }
   }
 
@@ -1303,6 +1317,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
     wwo->volume_right = 100;
 
     InitializeCriticalSection(&wwo->access_crst); /* initialize the critical section */
+    wwo->access_crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINE_WAVEOUT.access_crst");
     EnterCriticalSection(&wwo->access_crst);
 
     dwFlags &= ~WAVE_DIRECTSOUND;  /* direct sound not supported, ignore the flag */
@@ -1317,6 +1332,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
     {
       ERR("JACK_OpenWaveOutDevice(%d) failed\n", wDevID);
       LeaveCriticalSection(&wwo->access_crst);
+      wwo->access_crst.DebugInfo->Spare[0] = 0;
       DeleteCriticalSection(&wwo->access_crst); /* delete the critical section so we can initialize it again from wodOpen() */
       return MMSYSERR_ERROR;		/* return unspecified error */
     }
@@ -1341,6 +1357,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
 #else
       JACK_CloseWaveOutDevice(wwo); /* close this device */
 #endif
+      wwo->access_crst.DebugInfo->Spare[0] = 0;
       DeleteCriticalSection(&wwo->access_crst); /* delete the critical section so we can initialize it again from wodOpen() */
       return WAVERR_BADFORMAT;
     }
@@ -1395,6 +1412,7 @@ static DWORD wodClose(WORD wDevID)
 #else
       JACK_CloseWaveOutDevice(wwo); /* close the jack device */
 #endif
+      wwo->access_crst.DebugInfo->Spare[0] = 0;
       DeleteCriticalSection(&wwo->access_crst); /* delete the critical section so we can initialize it again from wodOpen() */
 
       ret = wodNotifyClient(wwo, WOM_CLOSE, 0L, 0L);
@@ -2096,6 +2114,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
     wwi->state = WINE_WS_STOPPED; /* start in a stopped state */
 
     InitializeCriticalSection(&wwi->access_crst); /* initialize the critical section */
+    wwi->access_crst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINE_WAVEIN.access_crst");
     EnterCriticalSection(&wwi->access_crst);
 
     /* open up jack ports for this device */
@@ -2103,6 +2122,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
     {
       ERR("JACK_OpenWaveInDevice(%d) failed\n", wDevID);
       LeaveCriticalSection(&wwi->access_crst);
+      wwi->access_crst.DebugInfo->Spare[0] = 0;
       DeleteCriticalSection(&wwi->access_crst);
       return MMSYSERR_ERROR;		/* return unspecified error */
     }
@@ -2134,6 +2154,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
 #else
       JACK_CloseWaveInDevice(wwi); /* close this device */
 #endif
+      wwi->access_crst.DebugInfo->Spare[0] = 0;
       DeleteCriticalSection(&wwi->access_crst);
       return WAVERR_BADFORMAT;
     }
@@ -2188,6 +2209,7 @@ static DWORD widClose(WORD wDevID)
 #else
 	JACK_CloseWaveInDevice(wwi); /* close the jack device */
 #endif
+        wwi->access_crst.DebugInfo->Spare[0] = 0;
 	DeleteCriticalSection(&wwi->access_crst); /* delete the critical section so we can initialize it again from wodOpen() */
 	
 	ret = widNotifyClient(wwi, WIM_CLOSE, 0L, 0L);



More information about the wine-patches mailing list