Skip to content

Commit

Permalink
Fix for external log segfault after SIGINT (ros2#844)
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Lihui <Lihui.Chen@sony.com>
  • Loading branch information
Chen Lihui authored Oct 30, 2020
1 parent a9f9470 commit 900a059
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rcl/src/rcl/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ rcl_ret_t rcl_logging_fini()
{
rcl_ret_t status = RCL_RET_OK;
rcutils_logging_set_output_handler(rcutils_logging_console_output_handler);
// In order to output log message to `rcutils_logging_console_output_handler`
// and `rcl_logging_ext_lib_output_handler` is not called after `rcl_logging_fini`,
// in addition to calling `rcutils_logging_set_output_handler`,
// the `g_rcl_logging_num_out_handlers` and `g_rcl_logging_out_handlers` must be updated.
g_rcl_logging_num_out_handlers = 1;
g_rcl_logging_out_handlers[0] = rcutils_logging_console_output_handler;

if (g_rcl_logging_rosout_enabled) {
status = rcl_logging_rosout_fini();
Expand Down

0 comments on commit 900a059

Please sign in to comment.