diff options
author | Chris Robinson <[email protected]> | 2019-01-26 19:29:26 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-26 19:29:26 -0800 |
commit | f98a24fb8ac8fcaae61a4e31f49e774c1b83a046 (patch) | |
tree | a895be246008cfa69869d44c948cba6c8d48b804 | |
parent | f5e17bafea0a1255a6bae5f833ef3dc082e63cf7 (diff) |
Don't try to clean up the async ringbuffer if it isn't allocated
-rw-r--r-- | Alc/alc.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index e42ec20f..d05d1431 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -2452,24 +2452,27 @@ ALCcontext::~ALCcontext() } TRACE("Freed " SZFMT " listener property object%s\n", count, (count==1)?"":"s"); - count = 0; - auto evt_vec = AsyncEvents->getReadVector(); - while(evt_vec.first.len > 0) + if(AsyncEvents) { - reinterpret_cast<AsyncEvent*>(evt_vec.first.buf)->~AsyncEvent(); - evt_vec.first.buf += sizeof(AsyncEvent); - evt_vec.first.len -= 1; - ++count; - } - while(evt_vec.second.len > 0) - { - reinterpret_cast<AsyncEvent*>(evt_vec.second.buf)->~AsyncEvent(); - evt_vec.second.buf += sizeof(AsyncEvent); - evt_vec.second.len -= 1; - ++count; + count = 0; + auto evt_vec = AsyncEvents->getReadVector(); + while(evt_vec.first.len > 0) + { + reinterpret_cast<AsyncEvent*>(evt_vec.first.buf)->~AsyncEvent(); + evt_vec.first.buf += sizeof(AsyncEvent); + evt_vec.first.len -= 1; + ++count; + } + while(evt_vec.second.len > 0) + { + reinterpret_cast<AsyncEvent*>(evt_vec.second.buf)->~AsyncEvent(); + evt_vec.second.buf += sizeof(AsyncEvent); + evt_vec.second.len -= 1; + ++count; + } + if(count > 0) + TRACE("Destructed " SZFMT " orphaned event%s\n", count, (count==1)?"":"s"); } - if(count > 0) - TRACE("Destructed " SZFMT " orphaned event%s\n", count, (count==1)?"":"s"); ALCdevice_DecRef(Device); } |