diff options
| author | Scott Mansell <phiren@gmail.com> | 2026-07-16 08:58:02 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-16 08:58:02 +1200 |
| commit | b6d8bc299ee7d03496d624b2e6b9a18d70522435 (patch) | |
| tree | c01bed4e8114186d9a7f6add3de06d9b3959c0c3 /Source | |
| parent | 81402ca6aa93503be38736b5dd6d8d96fcbfd0d5 (diff) | |
| parent | 05855a37f4d6b9e98e41e7c50983faa167ae03ac (diff) | |
Merge pull request #14726 from JosJuice/gcadapter-deregister-on-thread-end
GCAdapter: Deregister callback when scan thread exits
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/InputCommon/GCAdapter.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index e11d95d68f..dbffc4d81d 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -473,6 +473,17 @@ static void ScanThreadFunc() } #endif +#if GCADAPTER_USE_LIBUSB_IMPLEMENTATION +#if LIBUSB_API_HAS_HOTPLUG + if (s_libusb_hotplug_enabled) + libusb_hotplug_deregister_callback(*s_libusb_context, s_hotplug_handle); +#endif +#elif GCADAPTER_USE_ANDROID_IMPLEMENTATION + const jmethodID disable_hotplug_callback_func = + env->GetStaticMethodID(s_adapter_class, "disableHotplugCallback", "()V"); + env->CallStaticVoidMethod(s_adapter_class, disable_hotplug_callback_func); +#endif + NOTICE_LOG_FMT(CONTROLLERINTERFACE, "GC Adapter scanning thread stopped"); } @@ -761,17 +772,6 @@ static void AddGCAdapter(libusb_device* device) void Shutdown() { StopScanThread(); -#if GCADAPTER_USE_LIBUSB_IMPLEMENTATION -#if LIBUSB_API_HAS_HOTPLUG - if (s_libusb_context && s_libusb_context->IsValid() && s_libusb_hotplug_enabled) - libusb_hotplug_deregister_callback(*s_libusb_context, s_hotplug_handle); -#endif -#elif GCADAPTER_USE_ANDROID_IMPLEMENTATION - JNIEnv* const env = IDCache::GetEnvForThread(); - const jmethodID disable_hotplug_callback_func = - env->GetStaticMethodID(s_adapter_class, "disableHotplugCallback", "()V"); - env->CallStaticVoidMethod(s_adapter_class, disable_hotplug_callback_func); -#endif Reset(); #if GCADAPTER_USE_LIBUSB_IMPLEMENTATION |
