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 (#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
tfoote and wjwwood authored Sep 29, 2023
1 parent 9ff864c commit 7c1143d
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 7c1143d

Please sign in to comment.