From 61f7e7716c6743b16051d8c3ea4cea3b27d0197b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 14 Apr 2019 02:16:42 -0700 Subject: Remove the backend factory deinit method It was never actually called anywhere, and there's no safe place where it can be called. It's probably better to let the individual backends worry about cleaning themselves up anyway. --- Alc/backends/dsound.cpp | 66 +++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 41 deletions(-) (limited to 'Alc/backends/dsound.cpp') diff --git a/Alc/backends/dsound.cpp b/Alc/backends/dsound.cpp index 8b181d0d..00deafc1 100644 --- a/Alc/backends/dsound.cpp +++ b/Alc/backends/dsound.cpp @@ -99,38 +99,6 @@ HRESULT (WINAPI *pDirectSoundCaptureEnumerateW)(LPDSENUMCALLBACKW pDSEnumCallbac #endif -bool DSoundLoad(void) -{ -#ifdef HAVE_DYNLOAD - if(!ds_handle) - { - ds_handle = LoadLib("dsound.dll"); - if(!ds_handle) - { - ERR("Failed to load dsound.dll\n"); - return false; - } - -#define LOAD_FUNC(f) do { \ - p##f = reinterpret_cast(GetSymbol(ds_handle, #f)); \ - if(!p##f) \ - { \ - CloseLib(ds_handle); \ - ds_handle = nullptr; \ - return false; \ - } \ -} while(0) - LOAD_FUNC(DirectSoundCreate); - LOAD_FUNC(DirectSoundEnumerateW); - LOAD_FUNC(DirectSoundCaptureCreate); - LOAD_FUNC(DirectSoundCaptureEnumerateW); -#undef LOAD_FUNC - } -#endif - return true; -} - - #define MAX_UPDATES 128 struct DevMap { @@ -892,18 +860,34 @@ BackendFactory &DSoundBackendFactory::getFactory() } bool DSoundBackendFactory::init() -{ return DSoundLoad(); } - -void DSoundBackendFactory::deinit() { - PlaybackDevices.clear(); - CaptureDevices.clear(); - #ifdef HAVE_DYNLOAD - if(ds_handle) - CloseLib(ds_handle); - ds_handle = nullptr; + if(!ds_handle) + { + ds_handle = LoadLib("dsound.dll"); + if(!ds_handle) + { + ERR("Failed to load dsound.dll\n"); + return false; + } + +#define LOAD_FUNC(f) do { \ + p##f = reinterpret_cast(GetSymbol(ds_handle, #f)); \ + if(!p##f) \ + { \ + CloseLib(ds_handle); \ + ds_handle = nullptr; \ + return false; \ + } \ +} while(0) + LOAD_FUNC(DirectSoundCreate); + LOAD_FUNC(DirectSoundEnumerateW); + LOAD_FUNC(DirectSoundCaptureCreate); + LOAD_FUNC(DirectSoundCaptureEnumerateW); +#undef LOAD_FUNC + } #endif + return true; } bool DSoundBackendFactory::querySupport(BackendType type) -- cgit v1.2.3