aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/opensl.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-28 23:32:28 -0800
committerChris Robinson <[email protected]>2018-01-28 23:32:28 -0800
commita042dbf30524429b49adb63efda35f53054ae924 (patch)
tree6e905d8173f2db6dd41b2e9cb471a9c860c54279 /Alc/backends/opensl.c
parent328fd7329d1ae1554452d2d4b0384173c0f47079 (diff)
Call the backend close method in the destructor
Diffstat (limited to 'Alc/backends/opensl.c')
-rw-r--r--Alc/backends/opensl.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/Alc/backends/opensl.c b/Alc/backends/opensl.c
index 4ec003d8..c1283111 100644
--- a/Alc/backends/opensl.c
+++ b/Alc/backends/opensl.c
@@ -194,21 +194,7 @@ static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *devi
static void ALCopenslPlayback_Destruct(ALCopenslPlayback* self)
{
- if(self->mBufferQueueObj != NULL)
- VCALL0(self->mBufferQueueObj,Destroy)();
- self->mBufferQueueObj = NULL;
-
- if(self->mOutputMix != NULL)
- VCALL0(self->mOutputMix,Destroy)();
- self->mOutputMix = NULL;
-
- if(self->mEngineObj != NULL)
- VCALL0(self->mEngineObj,Destroy)();
- self->mEngineObj = NULL;
- self->mEngine = NULL;
-
- ll_ringbuffer_free(self->mRing);
- self->mRing = NULL;
+ ALCopenslPlayback_close(self);
alcnd_destroy(&self->mCond);
@@ -409,10 +395,12 @@ static void ALCopenslPlayback_close(ALCopenslPlayback *self)
VCALL0(self->mBufferQueueObj,Destroy)();
self->mBufferQueueObj = NULL;
- VCALL0(self->mOutputMix,Destroy)();
+ if(self->mOutputMix)
+ VCALL0(self->mOutputMix,Destroy)();
self->mOutputMix = NULL;
- VCALL0(self->mEngineObj,Destroy)();
+ if(self->mEngineObj)
+ VCALL0(self->mEngineObj,Destroy)();
self->mEngineObj = NULL;
self->mEngine = NULL;
}
@@ -761,18 +749,7 @@ static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device
static void ALCopenslCapture_Destruct(ALCopenslCapture *self)
{
- ll_ringbuffer_free(self->mRing);
- self->mRing = NULL;
-
- if(self->mRecordObj != NULL)
- VCALL0(self->mRecordObj,Destroy)();
- self->mRecordObj = NULL;
-
- if(self->mEngineObj != NULL)
- VCALL0(self->mEngineObj,Destroy)();
- self->mEngineObj = NULL;
- self->mEngine = NULL;
-
+ ALCopenslCapture_close(self);
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
}