Fix NvmeSensor assert
As NvmeSensor has many async captures, deleting
the NvmeContext is not enough to make the destructor
fire, we must also manually stop all timers and
connections.
Tested: DC Cycled, assert went away
Change-Id: I64f3eab1451d73d723110a79ed5bb38419982088
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index 8a1f4bc..1e02a4c 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -42,6 +42,13 @@
std::move([&io, &objectServer, &dbusConnection](
const ManagedObjectType& sensorConfigurations) {
// todo: it'd be better to only update the ones we care about
+ for (const auto& [_, nvmeContextPtr] : nvmeDeviceMap)
+ {
+ if (nvmeContextPtr)
+ {
+ nvmeContextPtr->close();
+ }
+ }
nvmeDeviceMap.clear();
// iterate through all found configurations