Skip to content

Commit

Permalink
Merge pull request #54 from karlhorky/patch-1
Browse files Browse the repository at this point in the history
Fix device added callback
  • Loading branch information
artginzburg authored Jan 3, 2023
2 parents d44200e + 07568c9 commit 3c2cc74
Showing 1 changed file with 9 additions and 12 deletions.
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

0 comments on commit 3c2cc74

Please sign in to comment.