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. (#22490)

Fixes #22488
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Sep 15, 2022
1 parent f351214 commit 4244915
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 4244915

Please sign in to comment.