Skip to content

Commit

Permalink
Fix integer signed issue and MTRDeviceController cleanup crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jtung-apple committed Dec 9, 2022
1 parent 926bbae commit 75a9236
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,13 @@ - (void)_handleSubscriptionReset
}

MTR_LOG_INFO("%@ scheduling to reattempt subscription in %u seconds", self, _lastSubscriptionAttemptWait);
dispatch_after(
dispatch_time(DISPATCH_TIME_NOW, static_cast<int64_t>(_lastSubscriptionAttemptWait) * NSEC_PER_SEC), self.queue, ^{
os_unfair_lock_lock(&self->_lock);
MTR_LOG_INFO("%@ reattempting subscription", self);
self.reattemptingSubscription = NO;
[self _setupSubscription];
os_unfair_lock_unlock(&self->_lock);
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_lastSubscriptionAttemptWait * NSEC_PER_SEC)), self.queue, ^{
os_unfair_lock_lock(&self->_lock);
MTR_LOG_INFO("%@ reattempting subscription", self);
self.reattemptingSubscription = NO;
[self _setupSubscription];
os_unfair_lock_unlock(&self->_lock);
});

os_unfair_lock_unlock(&self->_lock);
}
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (void)cleanup
_deviceControllerDelegateBridge = nullptr;
}

for (MTRDevice * device in self.nodeIDToDeviceMap) {
for (MTRDevice * device in [self.nodeIDToDeviceMap allValues]) {
[device invalidate];
}
[self.nodeIDToDeviceMap removeAllObjects];
Expand Down

0 comments on commit 75a9236

Please sign in to comment.