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:
parent
45fbdaa9c9
commit
0e082d5c46
1 changed files with 8 additions and 6 deletions
|
@ -329,14 +329,14 @@ FGMacOSXInputDevice::FGMacOSXInputDevice(IOHIDDeviceRef hidRef,
|
||||||
_hid = hidRef;
|
_hid = hidRef;
|
||||||
CFRetain(_hid);
|
CFRetain(_hid);
|
||||||
_subsystem = subsys;
|
_subsystem = subsys;
|
||||||
|
|
||||||
CFIndex maxDepth = 128;
|
|
||||||
_queue = IOHIDQueueCreate(kCFAllocatorDefault, _hid, maxDepth, kIOHIDOptionsTypeNone);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FGMacOSXInputDevice::~FGMacOSXInputDevice()
|
FGMacOSXInputDevice::~FGMacOSXInputDevice()
|
||||||
{
|
{
|
||||||
CFRelease(_queue);
|
if (_queue) {
|
||||||
|
CFRelease(_queue);
|
||||||
|
}
|
||||||
|
|
||||||
CFRelease(_hid);
|
CFRelease(_hid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,9 +348,11 @@ bool FGMacOSXInputDevice::Open()
|
||||||
}
|
}
|
||||||
|
|
||||||
IOHIDDeviceScheduleWithRunLoop(_hid, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
IOHIDDeviceScheduleWithRunLoop(_hid, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||||
|
|
||||||
// IOHIDQueueRegisterValueAvailableCallback(_queue, valueAvailableCallback, this);
|
// IOHIDQueueRegisterValueAvailableCallback(_queue, valueAvailableCallback, this);
|
||||||
|
|
||||||
|
CFIndex maxDepth = 128;
|
||||||
|
_queue = IOHIDQueueCreate(kCFAllocatorDefault, _hid, maxDepth, kIOHIDOptionsTypeNone);
|
||||||
|
|
||||||
IOHIDQueueScheduleWithRunLoop(_queue, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
IOHIDQueueScheduleWithRunLoop(_queue, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||||
IOHIDQueueStart(_queue);
|
IOHIDQueueStart(_queue);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue