aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/portaudio.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/portaudio.c
parent328fd7329d1ae1554452d2d4b0384173c0f47079 (diff)
Call the backend close method in the destructor
Diffstat (limited to 'Alc/backends/portaudio.c')
-rw-r--r--Alc/backends/portaudio.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c
index b793486f..58cf9762 100644
--- a/Alc/backends/portaudio.c
+++ b/Alc/backends/portaudio.c
@@ -165,10 +165,7 @@ static void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device)
static void ALCportPlayback_Destruct(ALCportPlayback *self)
{
- if(self->stream)
- Pa_CloseStream(self->stream);
- self->stream = NULL;
-
+ ALCportPlayback_close(self);
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
}
@@ -255,7 +252,7 @@ retry_open:
static void ALCportPlayback_close(ALCportPlayback *self)
{
- PaError err = Pa_CloseStream(self->stream);
+ PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError;
if(err != paNoError)
ERR("Error closing stream: %s\n", Pa_GetErrorText(err));
self->stream = NULL;
@@ -362,14 +359,7 @@ static void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device)
static void ALCportCapture_Destruct(ALCportCapture *self)
{
- if(self->stream)
- Pa_CloseStream(self->stream);
- self->stream = NULL;
-
- if(self->ring)
- ll_ringbuffer_free(self->ring);
- self->ring = NULL;
-
+ ALCportCapture_close(self);
ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
}
@@ -454,7 +444,7 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name)
static void ALCportCapture_close(ALCportCapture *self)
{
- PaError err = Pa_CloseStream(self->stream);
+ PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError;
if(err != paNoError)
ERR("Error closing stream: %s\n", Pa_GetErrorText(err));
self->stream = NULL;