From 3d4649a88a9ce77ea4c7244ddb1e19915017ed92 Mon Sep 17 00:00:00 2001 From: chrisdecenzo <61757564+chrisdecenzo@users.noreply.github.com> Date: Wed, 11 May 2022 12:29:16 -0700 Subject: [PATCH] Make sure DeviceController can be Setup after Shutdown and use the expected FabricTable (#18337) --- src/controller/CHIPDeviceControllerFactory.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index f46d01cdad0e07..9b45c0fe25d6b6 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -82,6 +82,7 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState() params.fabricIndependentStorage = mFabricIndependentStorage; params.enableServerInteractions = mEnableServerInteractions; params.groupDataProvider = mSystemState->GetGroupDataProvider(); + params.fabricTable = mSystemState->Fabrics(); } return InitSystemState(params); @@ -414,6 +415,10 @@ CHIP_ERROR DeviceControllerSystemState::Shutdown() { chip::Platform::Delete(mTempFabricTable); mTempFabricTable = nullptr; + // if we created a temp fabric table, then mFabrics points to it. + // if we did not create a temp fabric table, then keep the reference + // so that SetupController/Commissioner can use it + mFabrics = nullptr; } return CHIP_NO_ERROR;