diff options
author | kdhp <[email protected]> | 2018-06-08 01:42:13 +0000 |
---|---|---|
committer | kdhp <[email protected]> | 2018-06-08 01:42:13 +0000 |
commit | 35b78d55a4554d41bfcb8864c080ea1164c9b183 (patch) | |
tree | 0dba9aa357f8640b89f44e56ee78e677f5671f75 /Alc/ALc.c | |
parent | bd9c6989c20ea40cc12dd54105ec708c4b28beaa (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.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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; |