aboutsummaryrefslogtreecommitdiffstats
path: root/router/router.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-10-30 17:03:21 -0700
committerChris Robinson <[email protected]>2018-10-30 17:03:21 -0700
commitda150572f94ec354c8061c0bf1aafa0926c6dbc7 (patch)
tree916247e9790b7ae5649b44a14763e61d3bdc2d34 /router/router.h
parent615c025b6786adfd38446559b48b453e1e6c4883 (diff)
Clean up the DriverIface in its destructor
Diffstat (limited to 'router/router.h')
-rw-r--r--router/router.h14
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;