Use IOHIDManagerRegisterDeviceRemovalCallback() to monitor for HID removal

The function we currently use, IOHIDDeviceRegisterRemovalCallback(), often
fails on Catalina with a "__CFRunLoopModeFindSourceForMachPort returned NULL"
error message. Once a removal callback is missed, we will eventually crash when
the joystick is closed attempting to use the invalid IOHIDDeviceRef.

https://forums.developer.apple.com/thread/124444
1 file changed