Skip to content

Commit

Permalink
Update SignalHandler get_global_signal_handler to avoid complex types…
Browse files Browse the repository at this point in the history
… in static memory (ros2#2316)

* Update SignalHandler get_global_signal_handler to avoid complex types in static memory

This was flagged by msan as a problem.

There's a description of why this is a potential problem here: https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables

Signed-off-by: Tully Foote <tullyfoote@intrinsic.ai>
Co-authored-by: William Woodall <william+github@osrfoundation.org>
  • Loading branch information
2 people authored and Barry-Xu-2018 committed Jan 12, 2024
1 parent 2ca4c3e commit 1800839
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rclcpp/src/rclcpp/signal_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ SignalHandler::get_logger()
SignalHandler &
SignalHandler::get_global_signal_handler()
{
static SignalHandler signal_handler;
static SignalHandler & signal_handler = *new SignalHandler();
return signal_handler;
}

Expand Down

0 comments on commit 1800839

Please sign in to comment.