From a4d5848fe8ec27b1fc0351d56ae8fc308526fe0c Mon Sep 17 00:00:00 2001 From: pepeRossRobotics <66112254+pepeRossRobotics@users.noreply.github.com> Date: Wed, 23 Apr 2025 02:08:54 +0100 Subject: [PATCH] Change the default capture of complete_func to capture return_status by value: Now every TestNodeConfig instance has its own copy of return_status, and no dangling pointer ever occurs, eliminating the illegal IDLE return in onRunning(). --- include/behaviortree_cpp/actions/test_node.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/behaviortree_cpp/actions/test_node.h b/include/behaviortree_cpp/actions/test_node.h index c144fd43a..db1c2d7c0 100644 --- a/include/behaviortree_cpp/actions/test_node.h +++ b/include/behaviortree_cpp/actions/test_node.h @@ -39,7 +39,7 @@ struct TestNodeConfig /// Function invoked when the action is completed. By default just return [return_status] /// Override it to intorduce more comple cases - std::function complete_func = [this]() { return return_status; }; + std::function complete_func = [ret = return_status]() { return ret; }; }; /**