Skip to content

Commit a4d5848

Browse files
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().
1 parent 5f3f675 commit a4d5848

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/behaviortree_cpp/actions/test_node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct TestNodeConfig
3939

4040
/// Function invoked when the action is completed. By default just return [return_status]
4141
/// Override it to intorduce more comple cases
42-
std::function<NodeStatus(void)> complete_func = [this]() { return return_status; };
42+
std::function<NodeStatus(void)> complete_func = [ret = return_status]() { return ret; };
4343
};
4444

4545
/**

0 commit comments

Comments
 (0)