aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorkdhp <[email protected]>2018-06-08 01:42:13 +0000
committerkdhp <[email protected]>2018-06-08 01:42:13 +0000
commit35b78d55a4554d41bfcb8864c080ea1164c9b183 (patch)
tree0dba9aa357f8640b89f44e56ee78e677f5671f75 /Alc/ALc.c
parentbd9c6989c20ea40cc12dd54105ec708c4b28beaa (diff)
Stop capture devices while closing
In 'alcCaptureCloseDevice', check if the capture device is running and stop it if necessary. This fixes the case where the device data is deallocated while a background thread is still running (Issue #199)
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 1858c29b..2e9dc710 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -4401,6 +4401,12 @@ ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device)
}
UnlockLists();
+ almtx_lock(&device->BackendLock);
+ if((device->Flags&DEVICE_RUNNING))
+ V0(device->Backend,stop)();
+ device->Flags &= ~DEVICE_RUNNING;
+ almtx_unlock(&device->BackendLock);
+
ALCdevice_DecRef(device);
return ALC_TRUE;