Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix device added callback #54

Merged
merged 1 commit into from
Jan 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions MiddleClick/Controller.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,12 @@ - (void)start
@"attached devices",
err);
IONotificationPortDestroy(port);
} else {
io_object_t item;
while ((item = IOIteratorNext(handle))) {
IOObjectRelease(item);
}
}
// else {
/// Iterate through all the existing entries to arm the notification. Removed due to: https://stackoverflow.com/questions/1209130/iphone-sdk-exc-bad-access-with-cfrelease-for-abaddressbookref
// io_object_t item;
// while ((item = IOIteratorNext(handle))) {
// CFRelease(item);
// }
// }

// when displays are reconfigured restart of the app is needed, so add a calback to the
// reconifguration of Core Graphics
Expand Down Expand Up @@ -309,11 +307,10 @@ static void restartApp()
void multitouchDeviceAddedCallback(void* _controller,
io_iterator_t iterator)
{
/// Loop through all the returned items. Removed due to: https://stackoverflow.com/questions/1209130/iphone-sdk-exc-bad-access-with-cfrelease-for-abaddressbookref
// io_object_t item;
// while ((item = IOIteratorNext(iterator))) {
// CFRelease(item);
// }
io_object_t item;
while ((item = IOIteratorNext(iterator))) {
IOObjectRelease(item);
}

NSLog(@"Multitouch device added, restarting...");
Controller* controller = (Controller*)_controller;
Expand Down