diff options
author | Chris Robinson <[email protected]> | 2018-11-18 00:38:31 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-18 00:38:31 -0800 |
commit | d7cc9b912b71b17d6cd1bb9726673b79a4c0173a (patch) | |
tree | 591ba44cad8cf3d7d6ec2303c8fab49e954f5168 /Alc/alc.cpp | |
parent | 38d6df9c1d10ac74af3454c67147dd21bb0a7bb8 (diff) |
Use new/delete for ALCcontext objects
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r-- | Alc/alc.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp index 7b55f120..1d6d55e0 100644 --- a/Alc/alc.cpp +++ b/Alc/alc.cpp @@ -2791,9 +2791,7 @@ static void FreeContext(ALCcontext *context) ALCdevice_DecRef(context->Device); context->Device = nullptr; - //Invalidate context - memset(context, 0, sizeof(ALCcontext)); - al_free(context); + delete context; } /* ReleaseContext @@ -3791,19 +3789,7 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ATOMIC_STORE_SEQ(&device->LastError, ALC_NO_ERROR); - if(device->Type == Playback && DefaultEffect.type != AL_EFFECT_NULL) - ALContext = static_cast<ALCcontext*>(al_calloc(16, - sizeof(ALCcontext)+sizeof(ALlistener)+sizeof(ALeffectslot))); - else - ALContext = static_cast<ALCcontext*>(al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener))); - if(!ALContext) - { - almtx_unlock(&device->BackendLock); - - alcSetError(device, ALC_OUT_OF_MEMORY); - ALCdevice_DecRef(device); - return nullptr; - } + ALContext = new ALCcontext{}; InitRef(&ALContext->ref, 1); ALContext->DefaultSlot = nullptr; |