From 3a7a4eb953619fc101ebae69664a6397cfecac1c Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Fri, 23 Oct 2020 15:21:43 +0200 Subject: [PATCH] Connect: Fix segfault when accessing solutions from multiple plan() calls Connect::init() was resetting its dynamically created JMG merged_jmg_, thus invalidating all previous solutions. Only reset the JMG in reset(). --- core/src/stages/connect.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/stages/connect.cpp b/core/src/stages/connect.cpp index c9f4cd06..f2552618 100644 --- a/core/src/stages/connect.cpp +++ b/core/src/stages/connect.cpp @@ -86,9 +86,8 @@ void Connect::init(const core::RobotModelConstPtr& robot_model) { } } - if (!errors && groups.size() >= 2) { // enable merging? + if (!errors && groups.size() >= 2 && !merged_jmg_) { // enable merging? try { - merged_jmg_.reset(); merged_jmg_.reset(task_constructor::merge(groups)); } catch (const std::runtime_error& e) { ROS_INFO_STREAM_NAMED("Connect", this->name() << ": " << e.what() << ". Disabling merging.");