File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
include/behaviortree_cpp/decorators Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,15 @@ class TimeoutNode : public DecoratorNode
7777 if (msec_ > 0 )
7878 {
7979 timer_id_ = timer_.add (std::chrono::milliseconds (msec_), [this ](bool aborted) {
80+ // Return immediately if the timer was aborted.
81+ // This function could be invoked during destruction of this object and
82+ // we don't want to access member variables if not needed.
83+ if (aborted)
84+ {
85+ return ;
86+ }
8087 std::unique_lock<std::mutex> lk (timeout_mutex_);
81- if (!aborted && child ()->status () == NodeStatus::RUNNING)
88+ if (child ()->status () == NodeStatus::RUNNING)
8289 {
8390 child_halted_ = true ;
8491 haltChild ();
Original file line number Diff line number Diff line change @@ -225,7 +225,9 @@ class TimerQueue
225225
226226 lk.unlock ();
227227 if (item.handler )
228+ {
228229 item.handler (item.id == 0 );
230+ }
229231 lk.lock ();
230232 }
231233 }
You can’t perform that action at this time.
0 commit comments