From 9140349886ae24a35fb5b348c6c6725d4a9ed6a2 Mon Sep 17 00:00:00 2001 From: Francois Gouget Date: Thu, 16 Jan 2003 01:16:46 +0000 Subject: [PATCH] Warn if open_count is already 0 when OSS_CloseDevice is called. Don't decrement it in that case. --- dlls/winmm/wineoss/audio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/winmm/wineoss/audio.c b/dlls/winmm/wineoss/audio.c index 5f27720ed2d..675101d5e20 100644 --- a/dlls/winmm/wineoss/audio.c +++ b/dlls/winmm/wineoss/audio.c @@ -370,7 +370,12 @@ static DWORD OSS_OpenDevice(OSS_DEVICE* ossdev, unsigned req_access, */ static void OSS_CloseDevice(OSS_DEVICE* ossdev) { - if (--ossdev->open_count == 0) + if (ossdev->open_count>0) { + ossdev->open_count--; + } else { + WARN("OSS_CloseDevice called too many times\n"); + } + if (ossdev->open_count == 0) { /* reset the device before we close it in case it is in a bad state */ ioctl(ossdev->fd, SNDCTL_DSP_RESET, 0);