Move Fan objects back to heap
Turns out that with the objects on the stack,
some of them were corrupt in the callbacks.
Change-Id: Ifd4179839d4e05fdb1f05e417093cb14cec3addc
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/monitor/main.cpp b/monitor/main.cpp
index c10efb9..5da6a5b 100644
--- a/monitor/main.cpp
+++ b/monitor/main.cpp
@@ -27,7 +27,7 @@
{
auto bus = sdbusplus::bus::new_default();
sd_event* events = nullptr;
- std::vector<Fan> fans;
+ std::vector<std::unique_ptr<Fan>> fans;
auto r = sd_event_default(&events);
if (r < 0)
@@ -45,7 +45,7 @@
for (const auto& fanDef : fanDefinitions)
{
- fans.emplace_back(bus, eventPtr, fanDef);
+ fans.emplace_back(std::make_unique<Fan>(bus, eventPtr, fanDef));
}
r = sd_event_loop(eventPtr.get());