From 0fefbc1a4b7de65c53f708c60102908de8218ada Mon Sep 17 00:00:00 2001 From: chendejin Date: Thu, 5 Sep 2024 12:22:35 +0800 Subject: [PATCH] fix CI --- .../network-commissioning.cpp | 2 +- .../network-commissioning.h | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 88ebc126031b1c..7614ea7abb8899 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -337,7 +337,7 @@ CHIP_ERROR ThreadScanResponseToTLV::EncodeTo(TLV::TLVWriter & writer, TLV::Tag t } // namespace #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION -IntrusiveList Instance::sInstances; +IntrusiveList Instance::sInstances; #endif Instance::Instance(EndpointId aEndpointId, WiFiDriver * apDelegate) : diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index 5e3d6d7698ff35..4bad925fd7a0f7 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -34,16 +34,11 @@ namespace app { namespace Clusters { namespace NetworkCommissioning { -// Instance inherits privately from this class to participate in Instance::sInstances -class InstanceListNode : public IntrusiveListNodeBase<> -{ -}; - // TODO: Use macro to disable some wifi or thread class Instance : public CommandHandlerInterface, public AttributeAccessInterface, #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - private InstanceListNode, + public IntrusiveListNodeBase<>, #endif public DeviceLayer::NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback, public DeviceLayer::NetworkCommissioning::Internal::WirelessDriver::ConnectCallback, @@ -92,7 +87,7 @@ class Instance : public CommandHandlerInterface, // TODO: This could be guarded by a separate multi-interface condition instead #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - static IntrusiveList sInstances; + static IntrusiveList sInstances; #endif EndpointId mEndpointId = kInvalidEndpointId; @@ -150,7 +145,15 @@ class Instance : public CommandHandlerInterface, Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::WiFiDriver * apDelegate); Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::ThreadDriver * apDelegate); Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::EthernetDriver * apDelegate); - virtual ~Instance() = default; + virtual ~Instance() + { +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + if (sInstances.Contains(this)) + { + sInstances.Remove(this); + } +#endif + }; }; // namespace NetworkCommissioning // NetworkDriver for the devices that don't have / don't need a real network driver.