aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/dsound.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/backends/dsound.c')
-rw-r--r--Alc/backends/dsound.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/Alc/backends/dsound.c b/Alc/backends/dsound.c
index 8a0a30cb..7760e39d 100644
--- a/Alc/backends/dsound.c
+++ b/Alc/backends/dsound.c
@@ -192,7 +192,7 @@ typedef struct ALCdsoundPlayback {
static int ALCdsoundPlayback_mixerProc(void *ptr);
static void ALCdsoundPlayback_Construct(ALCdsoundPlayback *self, ALCdevice *device);
-static DECLARE_FORWARD(ALCdsoundPlayback, ALCbackend, void, Destruct)
+static void ALCdsoundPlayback_Destruct(ALCdsoundPlayback *self);
static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *name);
static void ALCdsoundPlayback_close(ALCdsoundPlayback *self);
static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self);
@@ -214,6 +214,12 @@ static void ALCdsoundPlayback_Construct(ALCdsoundPlayback *self, ALCdevice *devi
SET_VTABLE2(ALCdsoundPlayback, ALCbackend, self);
}
+static void ALCdsoundPlayback_Destruct(ALCdsoundPlayback *self)
+{
+ ALCdsoundPlayback_close(self);
+ ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
+}
+
FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr)
{
@@ -399,9 +405,11 @@ static void ALCdsoundPlayback_close(ALCdsoundPlayback *self)
IDirectSoundBuffer_Release(self->PrimaryBuffer);
self->PrimaryBuffer = NULL;
- IDirectSound_Release(self->DS);
+ if(self->DS)
+ IDirectSound_Release(self->DS);
self->DS = NULL;
- CloseHandle(self->NotifyEvent);
+ if(self->NotifyEvent)
+ CloseHandle(self->NotifyEvent);
self->NotifyEvent = NULL;
}
@@ -661,7 +669,7 @@ typedef struct ALCdsoundCapture {
} ALCdsoundCapture;
static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device);
-static DECLARE_FORWARD(ALCdsoundCapture, ALCbackend, void, Destruct)
+static void ALCdsoundCapture_Destruct(ALCdsoundCapture *self);
static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *name);
static void ALCdsoundCapture_close(ALCdsoundCapture *self);
static DECLARE_FORWARD(ALCdsoundCapture, ALCbackend, ALCboolean, reset)
@@ -682,6 +690,12 @@ static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device
SET_VTABLE2(ALCdsoundCapture, ALCbackend, self);
}
+static void ALCdsoundCapture_Destruct(ALCdsoundCapture *self)
+{
+ ALCdsoundCapture_close(self);
+ ALCbackend_Destruct(STATIC_CAST(ALCbackend, self));
+}
+
static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *deviceName)
{
@@ -867,7 +881,8 @@ static void ALCdsoundCapture_close(ALCdsoundCapture *self)
self->DSCbuffer = NULL;
}
- IDirectSoundCapture_Release(self->DSC);
+ if(self->DSC)
+ IDirectSoundCapture_Release(self->DSC);
self->DSC = NULL;
}