mirror of
https://github.com/libretro/RetroArch.git
synced 2024-12-04 06:11:17 +00:00
macos: fix hid driver crash on disconnecting controller second time (#16860)
This commit is contained in:
parent
2290955e4c
commit
c579033abf
@ -495,7 +495,7 @@ static void iohidmanager_hid_device_remove(IOHIDDeviceRef device, iohidmanager_h
|
||||
for (i=0; i<MAX_USERS; i++)
|
||||
{
|
||||
struct iohidmanager_hid_adapter *a = (struct iohidmanager_hid_adapter*)hid->slots[i].data;
|
||||
if (!a)
|
||||
if (!a || !hid->slots[i].connected)
|
||||
continue;
|
||||
if (a->handle == device)
|
||||
{
|
||||
@ -517,6 +517,7 @@ static void iohidmanager_hid_device_remove(IOHIDDeviceRef device, iohidmanager_h
|
||||
|
||||
hid->buttons[adapter->slot] = 0;
|
||||
memset(hid->axes[adapter->slot], 0, sizeof(hid->axes));
|
||||
hid->slots[adapter->slot].data = NULL;
|
||||
|
||||
pad_connection_pad_deinit(&hid->slots[adapter->slot], adapter->slot);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user