diff options
author | Chris Robinson <[email protected]> | 2018-10-30 17:03:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-10-30 17:03:21 -0700 |
commit | da150572f94ec354c8061c0bf1aafa0926c6dbc7 (patch) | |
tree | 916247e9790b7ae5649b44a14763e61d3bdc2d34 /router/router.h | |
parent | 615c025b6786adfd38446559b48b453e1e6c4883 (diff) |
Clean up the DriverIface in its destructor
Diffstat (limited to 'router/router.h')
-rw-r--r-- | router/router.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/router/router.h b/router/router.h index 41060ecd..d2574e74 100644 --- a/router/router.h +++ b/router/router.h @@ -31,7 +31,7 @@ #define MAKE_ALC_VER(major, minor) (((major)<<8) | (minor)) -typedef struct DriverIface { +struct DriverIface { std::wstring Name; HMODULE Module{nullptr}; int ALCVer{0}; @@ -133,7 +133,17 @@ typedef struct DriverIface { LPALDOPPLERVELOCITY alDopplerVelocity{nullptr}; LPALSPEEDOFSOUND alSpeedOfSound{nullptr}; LPALDISTANCEMODEL alDistanceModel{nullptr}; -} DriverIface; + + DriverIface(std::wstring name, HMODULE mod) + : Name(std::move(name)), Module(mod) + { } + ~DriverIface() + { + if(Module) + FreeLibrary(Module); + Module = nullptr; + } +}; extern std::vector<DriverIface> DriverList; |