diff options
author | Matt Spinler <spinler@us.ibm.com> | 2017-05-12 11:31:53 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2017-05-12 11:33:31 -0500 |
commit | 84201119da1a5df30b9155de1d9c302d0ec021dd (patch) | |
tree | b5831a4638a07c61fe94b7891dc870a5bbc131dd | |
parent | e824f985e7e32923d9f76e3ad5baf4909880739f (diff) | |
download | phosphor-fan-presence-84201119da1a5df30b9155de1d9c302d0ec021dd.tar.gz phosphor-fan-presence-84201119da1a5df30b9155de1d9c302d0ec021dd.zip |
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>
-rw-r--r-- | monitor/main.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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 @@ int main() { 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 @@ int main() 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()); |