DevMgr: detachAll only detaches from attachedDeviceRoles

We no longer try to detach from the collection of specs. We
detach from the collection of attachedDeviceRoles. This means
our cleanup sequence no longer tries to clean up things that were
never set up to begin with.
This commit is contained in:
2025-09-28 13:04:07 -04:00
parent e45a9ee5d1
commit c0798d1bdb
+4 -4
View File
@@ -602,10 +602,10 @@ public:
[[maybe_unused]] std::shared_ptr<DetachAllAttachedDeviceRoles> context [[maybe_unused]] std::shared_ptr<DetachAllAttachedDeviceRoles> context
) )
{ {
for (const auto& spec : DeviceManager::deviceAttachmentSpecs) for (const auto& deviceRole : DeviceManager::attachedDeviceRoles)
{ {
DeviceManager::getInstance().detachSenseDeviceReq( DeviceManager::getInstance().detachSenseDeviceReq(
spec, deviceRole->deviceAttachmentSpec,
{context, std::bind( {context, std::bind(
&DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles2, &DetachAllAttachedDeviceRoles::detachAllAttachedDeviceRoles2,
context.get(), context, context.get(), context,
@@ -649,7 +649,7 @@ void DeviceManager::detachAllAttachedDeviceRoles(
Callback<detachAllAttachedDeviceRolesCbFn> cb Callback<detachAllAttachedDeviceRolesCbFn> cb
) )
{ {
if (DeviceManager::getInstance().deviceAttachmentSpecs.size() == 0) if (DeviceManager::getInstance().attachedDeviceRoles.size() == 0)
{ {
AsynchronousLoop tmp(0); AsynchronousLoop tmp(0);
cb.callbackFn(tmp); cb.callbackFn(tmp);
@@ -658,7 +658,7 @@ void DeviceManager::detachAllAttachedDeviceRoles(
const auto& caller = ComponentThread::getSelf(); const auto& caller = ComponentThread::getSelf();
auto request = std::make_shared<DetachAllAttachedDeviceRoles>( auto request = std::make_shared<DetachAllAttachedDeviceRoles>(
DeviceManager::getInstance().deviceAttachmentSpecs.size(), DeviceManager::getInstance().attachedDeviceRoles.size(),
caller, std::move(cb)); caller, std::move(cb));
mrntt::mrntt.thread->getIoService().post( mrntt::mrntt.thread->getIoService().post(