mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-17 23:31:45 +00:00
hidapi/mac: import mainstream commit c1b9d2ad
c1b9d2ad98
Properly handle the close of run loop on macOS
(https://github.com/libusb/hidapi/pull/522)
- as per documentation `kCFRunLoopRunStopped` should be handled once the runloop is closed via `CFRunLoopStop`;
- if it is not handled - a race condition/crash may happen on the latest macOS when a device gets disconnected while being open;
This commit is contained in:

committed by
Sam Lantinga

parent
ac607c1088
commit
62d1a2c836
@@ -771,7 +771,7 @@ static void *read_thread(void *param)
|
||||
while (!dev->shutdown_thread && !dev->disconnected) {
|
||||
code = CFRunLoopRunInMode(dev->run_loop_mode, 1000/*sec*/, FALSE);
|
||||
/* Return if the device has been disconnected */
|
||||
if (code == kCFRunLoopRunFinished) {
|
||||
if (code == kCFRunLoopRunFinished || code == kCFRunLoopRunStopped) {
|
||||
dev->disconnected = 1;
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user