1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00
Stefan Karlsson 6504ce448e LP-155 Workaround failing callback deregistration
Deregistration of hid_device_removal_callback fails because the call to
IOHIDDeviceRegisterRemovalCallback doesn't deregister it as it should.

This causes crashes when hid_device_removal_callback is called after
the read_thread has been shutdown.

This patch works around this problem by:

1) Letting the 'dev' hid_device, so that the callback can safely
   read the struct, even after the read_thread has been shut down
   and the memory should have been freed.

2) Making sure that the two racing callbacks that previously
   called CFRunLoopStop, hid_device_removal_callback and
   perform_signal_callback, now synchronize and make sure
    that CFRunLoopStop is only called once.
2015-10-15 22:11:53 +02:00
..