Fix sigsegv with createObjects
The create objects functor lambda was not properly capturing the
input object map.
Update the signature to accept an rvalue reference and move
construct the lambda copy.
Change-Id: I901fd978ea0882d5475b7340a2db1017d7aa443c
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/actions.hpp b/actions.hpp
index 634cbc9..2fea212 100644
--- a/actions.hpp
+++ b/actions.hpp
@@ -41,9 +41,9 @@
{
/** @brief Destroy objects action. */
-inline auto destroyObjects(std::vector<const char*> paths)
+inline auto destroyObjects(std::vector<const char*>&& paths)
{
- return [paths = std::move(paths)](auto&, auto & m)
+ return [=](auto&, auto & m)
{
m.destroyObjects(paths);
};
@@ -51,9 +51,9 @@
/** @brief Create objects action. */
inline auto createObjects(
- const std::map<sdbusplus::message::object_path, Object>& objs)
+ std::map<sdbusplus::message::object_path, Object>&& objs)
{
- return [&objs](auto&, auto & m)
+ return [=](auto&, auto & m)
{
m.createObjects(objs);
};