Skip to content

Commit 96eab29

Browse files
yunhanw-googlerestyled-commitsbzbarsky-apple
authored
[ICD] Shutdown icd client storage when destroying android controller (project-chip#36348) (project-chip#36481)
* Shutdown DefautICDClientStorage when destorying Android controller * Restyled by whitespace * Update DefaultICDClientStorage.h --------- Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent ce0101d commit 96eab29

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/app/icd/client/DefaultICDClientStorage.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -542,5 +542,14 @@ CHIP_ERROR DefaultICDClientStorage::ProcessCheckInPayload(const ByteSpan & paylo
542542
iterator->Release();
543543
return CHIP_ERROR_NOT_FOUND;
544544
}
545+
546+
void DefaultICDClientStorage::Shutdown()
547+
{
548+
mICDClientInfoIterators.ReleaseAll();
549+
mpClientInfoStore = nullptr;
550+
mpKeyStore = nullptr;
551+
mFabricList.clear();
552+
}
553+
545554
} // namespace app
546555
} // namespace chip

src/app/icd/client/DefaultICDClientStorage.h

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ class DefaultICDClientStorage : public ICDClientStorage
120120
CHIP_ERROR ProcessCheckInPayload(const ByteSpan & payload, ICDClientInfo & clientInfo,
121121
Protocols::SecureChannel::CounterType & counter) override;
122122

123+
/**
124+
* Shut down DefaultICDClientStorage
125+
*
126+
*/
127+
void Shutdown();
128+
123129
#if CONFIG_BUILD_FOR_HOST_UNIT_TEST
124130
size_t GetFabricListSize() { return mFabricList.size(); }
125131

src/controller/java/AndroidDeviceControllerWrapper.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ using namespace TLV;
5252

5353
AndroidDeviceControllerWrapper::~AndroidDeviceControllerWrapper()
5454
{
55+
getICDClientStorage()->Shutdown();
5556
mController->Shutdown();
5657

5758
#ifndef JAVA_MATTER_CONTROLLER_TEST

0 commit comments

Comments
 (0)