1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-26 09:29:45 +00:00

Free buffers before disposing of queue.

This commit is contained in:
Thomas Harte 2022-07-15 15:13:21 -04:00
parent 41af76bed8
commit bae47fca20

View File

@ -115,11 +115,6 @@
- (void)dealloc {
[_deallocLock lock];
if(_audioQueue) {
OSSGuard(AudioQueueDispose(_audioQueue, true));
_audioQueue = NULL;
}
for(size_t c = 0; c < NumBuffers; c++) {
if(_buffers[c]) {
OSSGuard(AudioQueueFreeBuffer(_audioQueue, _buffers[c]));
@ -127,6 +122,11 @@
}
}
if(_audioQueue) {
OSSGuard(AudioQueueDispose(_audioQueue, true));
_audioQueue = NULL;
}
// nil out the dealloc lock before entering the critical section such
// that it becomes impossible for anyone else to acquire.
NSLock *deallocLock = _deallocLock;