1
0
Fork 0

Tweaking macOS HID code to avoid a Catalina crash

Not certain what’s going on here, this is testing a theory that
deleting a HID queue which has never been started, might behave badly.
This commit is contained in:
James Turner 2019-10-17 00:01:59 +01:00
parent 45fbdaa9c9
commit 0e082d5c46

View file

@ -329,14 +329,14 @@ FGMacOSXInputDevice::FGMacOSXInputDevice(IOHIDDeviceRef hidRef,
_hid = hidRef;
CFRetain(_hid);
_subsystem = subsys;
CFIndex maxDepth = 128;
_queue = IOHIDQueueCreate(kCFAllocatorDefault, _hid, maxDepth, kIOHIDOptionsTypeNone);
}
FGMacOSXInputDevice::~FGMacOSXInputDevice()
{
CFRelease(_queue);
if (_queue) {
CFRelease(_queue);
}
CFRelease(_hid);
}
@ -348,9 +348,11 @@ bool FGMacOSXInputDevice::Open()
}
IOHIDDeviceScheduleWithRunLoop(_hid, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
// IOHIDQueueRegisterValueAvailableCallback(_queue, valueAvailableCallback, this);
CFIndex maxDepth = 128;
_queue = IOHIDQueueCreate(kCFAllocatorDefault, _hid, maxDepth, kIOHIDOptionsTypeNone);
IOHIDQueueScheduleWithRunLoop(_queue, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
IOHIDQueueStart(_queue);