Skip to content

Commit

Permalink
Mark MTRDeviceController as not running before shutting down the Devi…
Browse files Browse the repository at this point in the history
…ceCommissioner.

Fixes project-chip#22488
  • Loading branch information
bzbarsky-apple committed Sep 8, 2022
1 parent 5219c73 commit 9f77733
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ - (void)cleanupAfterStartup
- (void)shutDownCppController
{
if (_cppCommissioner) {
_cppCommissioner->Shutdown();
delete _cppCommissioner;
auto * commissionerToShutDown = _cppCommissioner;
// Flag ourselves as not running before we start shutting down
// _cppCommissioner, so we're not in a state where we claim to be
// running but are actually partially shut down.
_cppCommissioner = nullptr;
commissionerToShutDown->Shutdown();
delete commissionerToShutDown;
if (_operationalCredentialsDelegate != nil) {
_operationalCredentialsDelegate->SetDeviceCommissioner(nullptr);
}
Expand Down

0 comments on commit 9f77733

Please sign in to comment.