Skip to content

Commit

Permalink
[Matter.framework] Wrap the MatterControllerFactory shutdown code tha…
Browse files Browse the repository at this point in the history
…t is runned with atexit into its own autorelease pool (project-chip#35878)
  • Loading branch information
vivien-apple authored Oct 2, 2024
1 parent cbacbe3 commit 6022500
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@
static bool sExitHandlerRegistered = false;
static void ShutdownOnExit()
{
MTR_LOG("ShutdownOnExit invoked on exit");
[[MTRDeviceControllerFactory sharedInstance] stopControllerFactory];
// Depending on the structure of the software, this code might execute *after* the main autorelease pool has exited.
// Therefore, it needs to be enclosed in its own autorelease pool.
@autoreleasepool {
MTR_LOG("ShutdownOnExit invoked on exit");
[[MTRDeviceControllerFactory sharedInstance] stopControllerFactory];
}
}

@interface MTRDeviceControllerFactoryParams ()
Expand Down

0 comments on commit 6022500

Please sign in to comment.