Skip to content

Commit 5360e03

Browse files
committed
better device unplug handling on Windows
1 parent 9f2c472 commit 5360e03

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

windows/hid.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,7 @@ DWORD WINAPI hid_internal_notify_callback(HCMNOTIFICATION notify, PVOID context,
11421142
if (_stricmp((*current)->path, path) == 0) {
11431143
struct hid_device_info *next = (*current)->next;
11441144
device = *current;
1145+
device->next = NULL;
11451146
*current = next;
11461147
break;
11471148
}
@@ -1176,8 +1177,6 @@ DWORD WINAPI hid_internal_notify_callback(HCMNOTIFICATION notify, PVOID context,
11761177

11771178
/* Free removed device */
11781179
if (hotplug_event == HID_API_HOTPLUG_EVENT_DEVICE_LEFT) {
1179-
/* Ensure only this node is freed by hid_free_enumeration() */
1180-
device->next = NULL;
11811180
hid_free_enumeration(device);
11821181
}
11831182

0 commit comments

Comments
 (0)