diff --git a/rclcpp/src/rclcpp/node.cpp b/rclcpp/src/rclcpp/node.cpp index 7cc352b019..7f30b36faf 100644 --- a/rclcpp/src/rclcpp/node.cpp +++ b/rclcpp/src/rclcpp/node.cpp @@ -168,6 +168,8 @@ Node::Node( node_services_(other.node_services_), node_clock_(other.node_clock_), node_parameters_(other.node_parameters_), + node_time_source_(other.node_time_source_), + node_waitables_(other.node_waitables_), node_options_(other.node_options_), sub_namespace_(extend_sub_namespace(other.get_sub_namespace(), sub_namespace)), effective_namespace_(create_effective_namespace(other.get_namespace(), sub_namespace_)) diff --git a/rclcpp_action/test/test_server.cpp b/rclcpp_action/test/test_server.cpp index c9d780d9d4..bf31c06391 100644 --- a/rclcpp_action/test/test_server.cpp +++ b/rclcpp_action/test/test_server.cpp @@ -205,6 +205,27 @@ TEST_F(TestServer, construction_and_destruction_wait_set_error) }, rclcpp::exceptions::RCLError); } +TEST_F(TestServer, construction_and_destruction_sub_node) +{ + auto parent_node = std::make_shared<rclcpp::Node>("construct_node", "/rclcpp_action/construct"); + auto sub_node = parent_node->create_sub_node("construct_sub_node"); + + ASSERT_NO_THROW( + { + using GoalHandle = rclcpp_action::ServerGoalHandle<Fibonacci>; + auto as = rclcpp_action::create_server<Fibonacci>( + sub_node, "fibonacci", + [](const GoalUUID &, std::shared_ptr<const Fibonacci::Goal>) { + return rclcpp_action::GoalResponse::REJECT; + }, + [](std::shared_ptr<GoalHandle>) { + return rclcpp_action::CancelResponse::REJECT; + }, + [](std::shared_ptr<GoalHandle>) {}); + (void)as; + }); +} + TEST_F(TestServer, handle_goal_called) { auto node = std::make_shared<rclcpp::Node>("handle_goal_node", "/rclcpp_action/handle_goal");