diff --git a/rclcpp/src/rclcpp/executor.cpp b/rclcpp/src/rclcpp/executor.cpp index b8deac9399..ac837314a4 100644 --- a/rclcpp/src/rclcpp/executor.cpp +++ b/rclcpp/src/rclcpp/executor.cpp @@ -60,9 +60,8 @@ Executor::Executor(const ExecutorArgs & args) // Store the context for later use. context_ = args.context; - if (rcl_wait_set_init( - &wait_set_, 0, 2, 0, 0, 0, allocator) != RCL_RET_OK) - { + ret = rcl_wait_set_init(&wait_set_, 0, 2, 0, 0, 0, context_->get_rcl_context().get(), allocator); + if (RCL_RET_OK != ret) { RCUTILS_LOG_ERROR_NAMED( "rclcpp", "failed to create wait set: %s", rcl_get_error_string().str); diff --git a/rclcpp/src/rclcpp/graph_listener.cpp b/rclcpp/src/rclcpp/graph_listener.cpp index 8fbad34169..1a181898c4 100644 --- a/rclcpp/src/rclcpp/graph_listener.cpp +++ b/rclcpp/src/rclcpp/graph_listener.cpp @@ -79,6 +79,7 @@ GraphListener::start_if_not_started() 0, // number_of_timers 0, // number_of_clients 0, // number_of_services + this->parent_context_->get_rcl_context().get(), rcl_get_default_allocator()); if (RCL_RET_OK != ret) { throw_from_rcl_error(ret, "failed to initialize wait set");