Skip to content

Commit b823a29

Browse files
Fixing darwin crashes, and XPC invalidation (project-chip#35056)
* Fixing crashes * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent f9ad5bf commit b823a29

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/darwin/Framework/CHIP/MTRDeviceController_XPC.mm

+10-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,16 @@ - (id)initWithUniqueIdentifier:(NSUUID *)UUID xpConnectionBlock:(NSXPCConnection
6767
self.xpcConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(MTRXPCClientProtocol)];
6868
self.xpcConnection.exportedObject = self;
6969

70-
MTR_LOG("Resuming new XPC connection");
71-
[self.xpcConnection resume];
70+
self.xpcConnection.interruptionHandler = ^{
71+
MTR_LOG_ERROR("XPC Connection for device controller interrupted: %@", UUID);
72+
};
73+
74+
self.xpcConnection.invalidationHandler = ^{
75+
MTR_LOG_ERROR("XPC Connection for device controller invalidated: %@", UUID);
76+
};
77+
78+
MTR_LOG("Activating new XPC connection");
79+
[self.xpcConnection activate];
7280
} else {
7381
MTR_LOG_ERROR("Failed to set up XPC Connection");
7482
return nil;

src/platform/Darwin/DnssdContexts.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ void MdnsContexts::Delete(GenericContext * context)
247247
if (context->serviceRef != nullptr)
248248
{
249249
DNSServiceRefDeallocate(context->serviceRef);
250+
context->serviceRef = nullptr;
250251
}
251252
chip::Platform::Delete(context);
252253
}

0 commit comments

Comments
 (0)