Skip to content

Commit

Permalink
Fix the crash seen when cleaning up MTRDiagnosticsLogHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
nivi-apple committed Nov 9, 2023
1 parent 2aaaf14 commit e0d286c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1401,14 +1401,16 @@ - (void)_invokeCompletion:(void (^)(NSURL * _Nullable logResult, NSError * error
queue:(dispatch_queue_t)queue
error:(NSError * _Nullable)error
{
if (self->_diagnosticLogsTransferHandler != nil) {
self->_diagnosticLogsTransferHandler->Reset();
delete (self->_diagnosticLogsTransferHandler);
self->_diagnosticLogsTransferHandler = nil;
}
dispatch_async(queue, ^{
completion(filepath, error);
});

dispatch_async(self.queue, ^{
if (self->_diagnosticLogsTransferHandler != nil) {
delete (self->_diagnosticLogsTransferHandler);
self->_diagnosticLogsTransferHandler = nil;
}
});
}

- (void)_invokeCompletionWithError:(void (^)(NSURL * _Nullable logResult, NSError * error))completion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
} else if (event.EventType != TransferSession::OutputEventType::kMsgToSend || !event.msgTypeData.HasMessageType(MessageType::BlockAckEOF)) {
error = CHIP_ERROR_INTERNAL;
}
Reset();

// Notify the MTRDevice via the callback that the BDX transfer has completed with error or success.
if (mCallback) {
Expand Down

0 comments on commit e0d286c

Please sign in to comment.