diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2018-12-25 09:32:38 -0800 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2018-12-25 09:32:38 -0800 |
commit | 63df7cd537bd43fb2548a112b051a1790ff1140e (patch) | |
tree | 99cc9c4ef001c2b3731a4768a8983d7c6f25b47f /Alc/alc.cpp | |
parent | 3b7f668b28dbc5ef156bad9aa79f16b32efb2eb3 (diff) |
Construct AsyncEvent objects directly in the ringbuffer
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r-- | Alc/alc.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index b6065e97..d13cfc54 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -2465,6 +2465,25 @@ ALCcontext_struct::~ALCcontext_struct() } TRACE("Freed " SZFMT " listener property object%s\n", count, (count==1)?"":"s"); + count = 0; + auto evt_vec = ll_ringbuffer_get_read_vector(AsyncEvents); + 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"); + delete AsyncEvents; AsyncEvents = nullptr; |