Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ca14aa8

Browse files
committed
critical bug fix affecting AsyncActionNode
When a Tree is copied, all the thread related to AsyncActionNode where invoked. As a consequence, they are never executed, despite the fact that the value RUNNING is returned.
1 parent 2db7bfe commit ca14aa8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/action_node.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ NodeStatus SimpleActionNode::tick()
5252
//-------------------------------------------------------
5353

5454
AsyncActionNode::AsyncActionNode(const std::string& name, const NodeConfiguration& config)
55-
: ActionNodeBase(name, config),
56-
keep_thread_alive_(true),
57-
start_action_(false)
55+
: ActionNodeBase(name, config)
5856
{
59-
thread_ = std::thread(&AsyncActionNode::asyncThreadLoop, this);
57+
6058
}
6159

6260
AsyncActionNode::~AsyncActionNode()
@@ -115,6 +113,10 @@ NodeStatus AsyncActionNode::executeTick()
115113
// The other thread is in charge for changing the status
116114
if (status() == NodeStatus::IDLE)
117115
{
116+
if( thread_.joinable() == false) {
117+
keep_thread_alive_ = true;
118+
thread_ = std::thread(&AsyncActionNode::asyncThreadLoop, this);
119+
}
118120
setStatus( NodeStatus::RUNNING );
119121
notifyStart();
120122
}

0 commit comments

Comments
 (0)