Skip to content

Commit

Permalink
Fixing darwin crashes, and XPC invalidation (#35056)
Browse files Browse the repository at this point in the history
* Fixing crashes

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Oct 4, 2024
1 parent 6ebd843 commit 1463900
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,16 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection
self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)];
self.xpcConnection.exportedObject = self;

MTR_LOG("Resuming new XPC connection");
[self.xpcConnection resume];
self.xpcConnection.interruptionHandler = ^{
MTR_LOG_ERROR("XPC Connection for device controller interrupted: %@", UUID);
};

self.xpcConnection.invalidationHandler = ^{
MTR_LOG_ERROR("XPC Connection for device controller invalidated: %@", UUID);
};

MTR_LOG("Activating new XPC connection");
[self.xpcConnection activate];
} else {
MTR_LOG_ERROR("Failed to set up XPC Connection");
return nil;
Expand Down
1 change: 1 addition & 0 deletions src/platform/Darwin/DnssdContexts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ void MdnsContexts::Delete(GenericContext * context)
if (context->serviceRef != nullptr)
{
DNSServiceRefDeallocate(context->serviceRef);
context->serviceRef = nullptr;
}
chip::Platform::Delete(context);
}
Expand Down

0 comments on commit 1463900

Please sign in to comment.