From d17c22c1da1915afbcb9e39f4bd5e7e28259a110 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 20 Dec 2015 13:39:49 +0200 Subject: [PATCH] Close the game controller device when deleting the object --- source/input/linux/gamecontroller.cpp | 5 +++++ source/input/linux/gamecontroller_platform.h | 1 + 2 files changed, 6 insertions(+) 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; -- 2.45.2