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

Fixing crash in darwin framework #33698

Merged
merged 4 commits into from
Jun 1, 2024
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
12 changes: 7 additions & 5 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,7 @@ - (void)_changeInternalState:(MTRInternalDeviceState)state
MTR_LOG("%@ internal state change %lu => %lu", self, static_cast<unsigned long>(lastState), static_cast<unsigned long>(state));

/* BEGIN DRAGONS: This is a huge hack for a specific use case, do not rename, remove or modify behavior here */
// TODO: This should only be called for thread devices
id<MTRDeviceDelegate> delegate = _weakDelegate.strongObject;
if ([delegate respondsToSelector:@selector(_deviceInternalStateChanged:)]) {
dispatch_async(_delegateQueue, ^{
Expand Down Expand Up @@ -3505,17 +3506,18 @@ - (BOOL)_deviceHasActiveSubscription
{
std::lock_guard lock(_lock);

// TODO: This should always return YES for thread devices
return HaveSubscriptionEstablishedRightNow(_internalDeviceState);
}

- (void)_deviceMayBeReachable
{
assertChipStackLockedByCurrentThread();

MTR_LOG("%@ _deviceMayBeReachable called", self);

[self _triggerResubscribeWithReason:@"SPI client indicated the device may now be reachable"
nodeLikelyReachable:YES];
// TODO: This should only be allowed for thread devices
[_deviceController asyncDispatchToMatterQueue:^{
[self _triggerResubscribeWithReason:@"SPI client indicated the device may now be reachable"
nodeLikelyReachable:YES];
} errorHandler:nil];
}

/* END DRAGONS */
Expand Down
Loading