From: Mikko Rasa Date: Sun, 20 Dec 2015 11:39:49 +0000 (+0200) Subject: Close the game controller device when deleting the object X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=d17c22c1da1915afbcb9e39f4bd5e7e28259a110;p=libs%2Fgui.git Close the game controller device when deleting the object --- diff --git a/source/input/linux/gamecontroller.cpp b/source/input/linux/gamecontroller.cpp index d5fed3b..7fc59ed 100644 --- a/source/input/linux/gamecontroller.cpp +++ b/source/input/linux/gamecontroller.cpp @@ -57,6 +57,11 @@ JsDevice::JsDevice(const string &fn) throw system_error(format("open(%s)", fn)); } +JsDevice::~JsDevice() +{ + sys_close(handle); +} + string JsDevice::get_name() const { char buf[128] = { 0 }; diff --git a/source/input/linux/gamecontroller_platform.h b/source/input/linux/gamecontroller_platform.h index 61bcdb5..517b1b0 100644 --- a/source/input/linux/gamecontroller_platform.h +++ b/source/input/linux/gamecontroller_platform.h @@ -14,6 +14,7 @@ private: public: JsDevice(const std::string &); + ~JsDevice(); std::string get_name() const;