-
Notifications
You must be signed in to change notification settings - Fork 47
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
Crash in -[RZBPeripheral cancelAllCommands] due to infinite loop #98
Comments
Unfortunately, our fix for this causes a different RZBluetooth test to fail. Here's our fix in - (void)cancelAllCommands
{
NSError *error = [NSError errorWithDomain:RZBluetoothErrorDomain
code:RZBluetoothConnectionCancelled
userInfo:@{}];
NSArray *commands = self.dispatch.commands.copy;
for (RZBCommand *command in commands) {
if (command.isExecuted == YES && command.isCompleted == NO) {
// We are in the completion handler of this command. Do not complete it or we will loop infinitely.
continue;
}
[self.dispatch completeCommand:command
withObject:nil error:error];
}
} This fixes the test case above, but it causes |
@joshuatbrown It seems that every access to |
@cpatterson-lilly I replaced my NSArray *commands;
@synchronized(self.dispatch.commands) {
commands = [self.dispatch.commands copy];
} The same test still fails for the same reason. I can leave the |
You can see my branch/commit above where I added the unit test and fixed the crash. But I'm still seeing the failure in |
Issue
In the completion block of
-[RZBPeripheral connectWithCompletion:]
, call-[RZBPeripheral cancelConnectionWithCompletion:]
. It'll create an infinite loop and eventually crash with an EXC_BAD_ACCESS.For example:
The text was updated successfully, but these errors were encountered: