Skip to content

Commit

Permalink
leak due to std::shared_ptr circular reference between Context and Gu…
Browse files Browse the repository at this point in the history
…ardCondition

  ros2/rclcpp#2497

Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed Apr 15, 2024
1 parent 73607e4 commit 5beec96
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions prover_rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ custom_executable(rclcpp_2226)
custom_executable(rclcpp_2379)
custom_executable(rclcpp_2417_pub)
custom_executable(rclcpp_2417_sub)
custom_executable(rclcpp_2497)

custom_executable(rosbag2_1586)

Expand Down
12 changes: 12 additions & 0 deletions prover_rclcpp/src/rclcpp_2497.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <memory>

#include <rclcpp/context.hpp>
#include <rclcpp/guard_condition.hpp>

int main(int argc, char** argv) {
auto context = std::make_shared<rclcpp::Context>();
context->init(argc, argv);
context->get_sub_context<rclcpp::GuardCondition>(context);
context->shutdown("shutdown");
return 0;
}

0 comments on commit 5beec96

Please sign in to comment.