diff options
author | Chris Robinson <[email protected]> | 2018-01-28 23:32:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-28 23:32:28 -0800 |
commit | a042dbf30524429b49adb63efda35f53054ae924 (patch) | |
tree | 6e905d8173f2db6dd41b2e9cb471a9c860c54279 /Alc/backends/pulseaudio.c | |
parent | 328fd7329d1ae1554452d2d4b0384173c0f47079 (diff) |
Call the backend close method in the destructor
Diffstat (limited to 'Alc/backends/pulseaudio.c')
-rw-r--r-- | Alc/backends/pulseaudio.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Alc/backends/pulseaudio.c b/Alc/backends/pulseaudio.c index 3208bf26..581f4c38 100644 --- a/Alc/backends/pulseaudio.c +++ b/Alc/backends/pulseaudio.c @@ -519,6 +519,7 @@ static void ALCpulsePlayback_Construct(ALCpulsePlayback *self, ALCdevice *device static void ALCpulsePlayback_Destruct(ALCpulsePlayback *self) { + ALCpulsePlayback_close(self); AL_STRING_DEINIT(self->device_name); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -958,12 +959,13 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name static void ALCpulsePlayback_close(ALCpulsePlayback *self) { - pulse_close(self->loop, self->context, self->stream); - self->loop = NULL; - self->context = NULL; - self->stream = NULL; - - alstr_clear(&self->device_name); + if(self->loop) + { + pulse_close(self->loop, self->context, self->stream); + self->loop = NULL; + self->context = NULL; + self->stream = NULL; + } } static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) @@ -1273,6 +1275,7 @@ static void ALCpulseCapture_Construct(ALCpulseCapture *self, ALCdevice *device) static void ALCpulseCapture_Destruct(ALCpulseCapture *self) { + ALCpulseCapture_close(self); AL_STRING_DEINIT(self->device_name); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -1621,12 +1624,13 @@ fail: static void ALCpulseCapture_close(ALCpulseCapture *self) { - pulse_close(self->loop, self->context, self->stream); - self->loop = NULL; - self->context = NULL; - self->stream = NULL; - - alstr_clear(&self->device_name); + if(self->loop) + { + pulse_close(self->loop, self->context, self->stream); + self->loop = NULL; + self->context = NULL; + self->stream = NULL; + } } static ALCboolean ALCpulseCapture_start(ALCpulseCapture *self) |