diff --git a/Source/Core/Core/IOS/USB/Host.cpp b/Source/Core/Core/IOS/USB/Host.cpp index 460f5a859f..a9bb3414d4 100644 --- a/Source/Core/Core/IOS/USB/Host.cpp +++ b/Source/Core/Core/IOS/USB/Host.cpp @@ -31,7 +31,10 @@ USBHost::USBHost(Kernel& ios, const std::string& device_name) : Device(ios, devi { } -USBHost::~USBHost() = default; +USBHost::~USBHost() +{ + StopThreads(); +} IPCCommandResult USBHost::Open(const OpenRequest& request) { diff --git a/Source/Core/Core/IOS/USB/Host.h b/Source/Core/Core/IOS/USB/Host.h index d1d0864097..3fe05e52df 100644 --- a/Source/Core/Core/IOS/USB/Host.h +++ b/Source/Core/Core/IOS/USB/Host.h @@ -53,13 +53,14 @@ protected: virtual void OnDeviceChange(ChangeEvent event, std::shared_ptr changed_device); virtual void OnDeviceChangeEnd(); virtual bool ShouldAddDevice(const USB::Device& device) const; - void StartThreads(); - void StopThreads(); IPCCommandResult HandleTransfer(std::shared_ptr device, u32 request, std::function submit) const; private: + void StartThreads(); + void StopThreads(); + bool AddDevice(std::unique_ptr device); bool UpdateDevices(bool always_add_hooks = false); diff --git a/Source/Core/Core/IOS/USB/OH0/OH0.cpp b/Source/Core/Core/IOS/USB/OH0/OH0.cpp index 39ee52dba9..a3d1f6d4b7 100644 --- a/Source/Core/Core/IOS/USB/OH0/OH0.cpp +++ b/Source/Core/Core/IOS/USB/OH0/OH0.cpp @@ -26,11 +26,6 @@ OH0::OH0(Kernel& ios, const std::string& device_name) : USBHost(ios, device_name { } -OH0::~OH0() -{ - StopThreads(); -} - IPCCommandResult OH0::Open(const OpenRequest& request) { if (HasFeature(m_ios.GetVersion(), Feature::NewUSB)) diff --git a/Source/Core/Core/IOS/USB/OH0/OH0.h b/Source/Core/Core/IOS/USB/OH0/OH0.h index a898b74fc8..881eba1ed4 100644 --- a/Source/Core/Core/IOS/USB/OH0/OH0.h +++ b/Source/Core/Core/IOS/USB/OH0/OH0.h @@ -37,7 +37,6 @@ class OH0 final : public USBHost { public: OH0(Kernel& ios, const std::string& device_name); - ~OH0() override; IPCCommandResult Open(const OpenRequest& request) override; IPCCommandResult IOCtl(const IOCtlRequest& request) override; diff --git a/Source/Core/Core/IOS/USB/USBV5.cpp b/Source/Core/Core/IOS/USB/USBV5.cpp index f78e8e6ae7..98a5af0af8 100644 --- a/Source/Core/Core/IOS/USB/USBV5.cpp +++ b/Source/Core/Core/IOS/USB/USBV5.cpp @@ -86,11 +86,6 @@ struct DeviceEntry #pragma pack(pop) } // namespace -USBV5ResourceManager::~USBV5ResourceManager() -{ - StopThreads(); -} - void USBV5ResourceManager::DoState(PointerWrap& p) { p.Do(m_devicechange_first_call); diff --git a/Source/Core/Core/IOS/USB/USBV5.h b/Source/Core/Core/IOS/USB/USBV5.h index 49827256d0..0740057146 100644 --- a/Source/Core/Core/IOS/USB/USBV5.h +++ b/Source/Core/Core/IOS/USB/USBV5.h @@ -69,7 +69,6 @@ class USBV5ResourceManager : public USBHost { public: using USBHost::USBHost; - ~USBV5ResourceManager() override; IPCCommandResult IOCtl(const IOCtlRequest& request) override = 0; IPCCommandResult IOCtlV(const IOCtlVRequest& request) override = 0; diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp index e205182b8e..b8513df344 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp @@ -26,11 +26,6 @@ USB_HIDv4::USB_HIDv4(Kernel& ios, const std::string& device_name) : USBHost(ios, { } -USB_HIDv4::~USB_HIDv4() -{ - StopThreads(); -} - IPCCommandResult USB_HIDv4::IOCtl(const IOCtlRequest& request) { request.Log(GetDeviceName(), Common::Log::IOS_USB); diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h index eb6b6d5661..1268c21b97 100644 --- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h +++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.h @@ -22,7 +22,6 @@ class USB_HIDv4 final : public USBHost { public: USB_HIDv4(Kernel& ios, const std::string& device_name); - ~USB_HIDv4() override; IPCCommandResult IOCtl(const IOCtlRequest& request) override;