From 9e83a99c9ce7f7e053baa28a61a65ea73b076232 Mon Sep 17 00:00:00 2001 From: Hayodea Hekol Date: Sat, 25 Oct 2025 23:03:00 -0400 Subject: [PATCH] LivoxProto1:Device: Refcount num stimbuffs attached --- commonLibs/livoxProto1/core.cpp | 2 +- commonLibs/livoxProto1/device.cpp | 1 + commonLibs/livoxProto1/device.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/commonLibs/livoxProto1/core.cpp b/commonLibs/livoxProto1/core.cpp index fa058f6..7b9b21e 100644 --- a/commonLibs/livoxProto1/core.cpp +++ b/commonLibs/livoxProto1/core.cpp @@ -230,7 +230,7 @@ void DeviceManager::destroyDeviceReq( std::shared_ptr device = getDevice(dev->discoveredDevice). value_or(nullptr); - if (!device) + if (!device || device->nAttachedStimBuffs > 0) { callback.callbackFn(false); return; diff --git a/commonLibs/livoxProto1/device.cpp b/commonLibs/livoxProto1/device.cpp index a6bcfbe..57aa4a8 100644 --- a/commonLibs/livoxProto1/device.cpp +++ b/commonLibs/livoxProto1/device.cpp @@ -97,6 +97,7 @@ Device::Device(const std::string &deviceIdentifier, deviceIdentifier, comms::DeviceType::Mid40, // Initialize empty. IP will be set upon successful connection. ""), +nAttachedStimBuffs(0), componentThread(componentThread), handshakeTimeoutMs(handshakeTimeoutMs), retryDelayMs(retryDelayMs), smoIp(smoIp), detectedSmoListeningIp(""), smoSubnetNbits(smoSubnetNbits), diff --git a/commonLibs/livoxProto1/device.h b/commonLibs/livoxProto1/device.h index 382cf08..4d795f9 100644 --- a/commonLibs/livoxProto1/device.h +++ b/commonLibs/livoxProto1/device.h @@ -140,6 +140,7 @@ public: public: comms::DiscoveredDevice discoveredDevice; + std::atomic nAttachedStimBuffs; // Configuration std::shared_ptr componentThread;