Properly destroy other objects
This commit is contained in:
parent
f27e73989c
commit
5f26205f8f
@ -2462,14 +2462,14 @@ ALCcontext::~ALCcontext()
|
||||
auto evt_vec = AsyncEvents->getReadVector();
|
||||
while(evt_vec.first.len > 0)
|
||||
{
|
||||
reinterpret_cast<AsyncEvent*>(evt_vec.first.buf)->~AsyncEvent();
|
||||
al::destroy_at(reinterpret_cast<AsyncEvent*>(evt_vec.first.buf));
|
||||
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();
|
||||
al::destroy_at(reinterpret_cast<AsyncEvent*>(evt_vec.second.buf));
|
||||
evt_vec.second.buf += sizeof(AsyncEvent);
|
||||
evt_vec.second.len -= 1;
|
||||
++count;
|
||||
|
@ -181,7 +181,7 @@ void aluInit(void)
|
||||
void DeinitVoice(ALvoice *voice) noexcept
|
||||
{
|
||||
delete voice->mUpdate.exchange(nullptr, std::memory_order_acq_rel);
|
||||
voice->~ALvoice();
|
||||
al::destroy_at(voice);
|
||||
}
|
||||
|
||||
|
||||
|
@ -204,7 +204,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
|
||||
ALenum err{InitEffectSlot(slot)};
|
||||
if(err != AL_NO_ERROR)
|
||||
{
|
||||
slot->~ALeffectslot();
|
||||
al::destroy_at(slot);
|
||||
alSetError(context, err, "Effect slot object initialization failed");
|
||||
return nullptr;
|
||||
}
|
||||
@ -225,7 +225,7 @@ void FreeEffectSlot(ALCcontext *context, ALeffectslot *slot)
|
||||
ALsizei lidx = id >> 6;
|
||||
ALsizei slidx = id & 0x3f;
|
||||
|
||||
slot->~ALeffectslot();
|
||||
al::destroy_at(slot);
|
||||
|
||||
context->EffectSlotList[lidx].FreeMask |= 1_u64 << slidx;
|
||||
context->NumEffectSlots--;
|
||||
@ -794,7 +794,7 @@ EffectSlotSubList::~EffectSlotSubList()
|
||||
while(usemask)
|
||||
{
|
||||
ALsizei idx{CTZ64(usemask)};
|
||||
EffectSlots[idx].~ALeffectslot();
|
||||
al::destroy_at(EffectSlots+idx);
|
||||
usemask &= ~(1_u64 << idx);
|
||||
}
|
||||
FreeMask = ~usemask;
|
||||
|
@ -108,7 +108,7 @@ void FreeBuffer(ALCdevice *device, ALbuffer *buffer)
|
||||
ALsizei lidx = id >> 6;
|
||||
ALsizei slidx = id & 0x3f;
|
||||
|
||||
buffer->~ALbuffer();
|
||||
al::destroy_at(buffer);
|
||||
|
||||
device->BufferList[lidx].FreeMask |= 1_u64 << slidx;
|
||||
}
|
||||
@ -1219,7 +1219,7 @@ BufferSubList::~BufferSubList()
|
||||
while(usemask)
|
||||
{
|
||||
ALsizei idx{CTZ64(usemask)};
|
||||
Buffers[idx].~ALbuffer();
|
||||
al::destroy_at(Buffers+idx);
|
||||
usemask &= ~(1_u64 << idx);
|
||||
}
|
||||
FreeMask = ~usemask;
|
||||
|
@ -183,7 +183,7 @@ void FreeEffect(ALCdevice *device, ALeffect *effect)
|
||||
ALsizei lidx = id >> 6;
|
||||
ALsizei slidx = id & 0x3f;
|
||||
|
||||
effect->~ALeffect();
|
||||
al::destroy_at(effect);
|
||||
|
||||
device->EffectList[lidx].FreeMask |= 1_u64 << slidx;
|
||||
}
|
||||
@ -518,7 +518,7 @@ EffectSubList::~EffectSubList()
|
||||
while(usemask)
|
||||
{
|
||||
ALsizei idx = CTZ64(usemask);
|
||||
Effects[idx].~ALeffect();
|
||||
al::destroy_at(Effects+idx);
|
||||
usemask &= ~(1_u64 << idx);
|
||||
}
|
||||
FreeMask = ~usemask;
|
||||
|
@ -327,7 +327,7 @@ void FreeFilter(ALCdevice *device, ALfilter *filter)
|
||||
ALsizei lidx = id >> 6;
|
||||
ALsizei slidx = id & 0x3f;
|
||||
|
||||
filter->~ALfilter();
|
||||
al::destroy_at(filter);
|
||||
|
||||
device->FilterList[lidx].FreeMask |= 1_u64 << slidx;
|
||||
}
|
||||
@ -647,7 +647,7 @@ FilterSubList::~FilterSubList()
|
||||
while(usemask)
|
||||
{
|
||||
ALsizei idx = CTZ64(usemask);
|
||||
Filters[idx].~ALfilter();
|
||||
al::destroy_at(Filters+idx);
|
||||
usemask &= ~(1_u64 << idx);
|
||||
}
|
||||
FreeMask = ~usemask;
|
||||
|
@ -544,7 +544,7 @@ void FreeSource(ALCcontext *context, ALsource *source)
|
||||
}
|
||||
backlock.unlock();
|
||||
|
||||
source->~ALsource();
|
||||
al::destroy_at(source);
|
||||
|
||||
context->SourceList[lidx].FreeMask |= 1_u64 << slidx;
|
||||
context->NumSources--;
|
||||
@ -3575,7 +3575,7 @@ SourceSubList::~SourceSubList()
|
||||
while(usemask)
|
||||
{
|
||||
ALsizei idx{CTZ64(usemask)};
|
||||
Sources[idx].~ALsource();
|
||||
al::destroy_at(Sources+idx);
|
||||
usemask &= ~(1_u64 << idx);
|
||||
}
|
||||
FreeMask = ~usemask;
|
||||
|
@ -42,7 +42,7 @@ static int EventThread(ALCcontext *context)
|
||||
RingBuffer *ring_;
|
||||
~EventAutoDestructor()
|
||||
{
|
||||
evt_.~AsyncEvent();
|
||||
al::destroy_at(&evt_);
|
||||
ring_->readAdvance(1);
|
||||
}
|
||||
} _{evt, ring};
|
||||
@ -99,7 +99,7 @@ static int EventThread(ALCcontext *context)
|
||||
void StartEventThrd(ALCcontext *ctx)
|
||||
{
|
||||
try {
|
||||
ctx->EventThread = std::thread(EventThread, ctx);
|
||||
ctx->EventThread = std::thread{EventThread, ctx};
|
||||
}
|
||||
catch(std::exception& e) {
|
||||
ERR("Failed to start event thread: %s\n", e.what());
|
||||
|
Loading…
Reference in New Issue
Block a user