aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/mmdevapi.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/mmdevapi.c
parent328fd7329d1ae1554452d2d4b0384173c0f47079 (diff)
Call the backend close method in the destructor
Diffstat (limited to 'Alc/backends/mmdevapi.c')
-rw-r--r--Alc/backends/mmdevapi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Alc/backends/mmdevapi.c b/Alc/backends/mmdevapi.c
index 55d8ec54..899f73d4 100644
--- a/Alc/backends/mmdevapi.c
+++ b/Alc/backends/mmdevapi.c
@@ -587,6 +587,8 @@ static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device
static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self)
{
+ ALCmmdevPlayback_close(self);
+
if(self->NotifyEvent != NULL)
CloseHandle(self->NotifyEvent);
self->NotifyEvent = NULL;
@@ -840,6 +842,9 @@ static void ALCmmdevPlayback_close(ALCmmdevPlayback *self)
{
ThreadRequest req = { self->MsgEvent, 0 };
+ if(!req.FinishedEvt)
+ return;
+
if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self)))
(void)WaitForResponse(&req);
@@ -1287,6 +1292,8 @@ static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device)
static void ALCmmdevCapture_Destruct(ALCmmdevCapture *self)
{
+ ALCmmdevCapture_close(self);
+
ll_ringbuffer_free(self->Ring);
self->Ring = NULL;
@@ -1573,6 +1580,9 @@ static void ALCmmdevCapture_close(ALCmmdevCapture *self)
{
ThreadRequest req = { self->MsgEvent, 0 };
+ if(!req.FinishedEvt)
+ return;
+
if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self)))
(void)WaitForResponse(&req);