Skip to content

Commit

Permalink
[darwin] Data race when accessing onConnectionComplete (#25487)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored and pull[bot] committed Oct 25, 2023
1 parent 91772b0 commit 1094162
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/platform/Darwin/BleConnectionDelegateImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,19 @@ - (void)resetTimer
// All our callback dispatch must happen on _chipWorkQueue
- (void)dispatchConnectionError:(CHIP_ERROR)error
{
if (self.onConnectionError == nil) {
return;
}

dispatch_async(_chipWorkQueue, ^{
self.onConnectionError(self.appState, error);
if (self.onConnectionError != nil) {
self.onConnectionError(self.appState, error);
}
});
}

- (void)dispatchConnectionComplete:(CBPeripheral *)peripheral
{
if (self.onConnectionComplete == nil) {
return;
}

dispatch_async(_chipWorkQueue, ^{
self.onConnectionComplete(self.appState, (__bridge void *) peripheral);
if (self.onConnectionComplete != nil) {
self.onConnectionComplete(self.appState, (__bridge void *) peripheral);
}
});
}

Expand Down

0 comments on commit 1094162

Please sign in to comment.