Skip to content

Commit

Permalink
messages: set the "discard" logger when exiting
Browse files Browse the repository at this point in the history
Normally closing a logger should not incur new log messages, but...
the early logger does exactly that, and this prevents it from looping
infinitely into itself. This situation occurs if no proper logger was
installed until the log switch was destroyed.

Fixes #26363.

This effectively reverts
commit e8700cb.
  • Loading branch information
Rémi Denis-Courmont authored and jbkempf committed Dec 13, 2021
1 parent abf527b commit eca2d51
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/misc/messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,16 @@ static void vlc_vaLogSwitch(void *d, int type, const vlc_log_t *item,
vlc_rcu_read_unlock();
}

static void vlc_LogSwitch(vlc_logger_t *logger, vlc_logger_t *new_logger);

static void vlc_LogSwitchClose(void *d)
{
struct vlc_logger *logger = d;
struct vlc_logger_switch *logswitch =
container_of(logger, struct vlc_logger_switch, frontend);
struct vlc_logger *backend = atomic_load_explicit(&logswitch->backend,
memory_order_relaxed);

backend->ops->destroy(backend);
/* Discard any further messages. */
vlc_LogSwitch(logger, &discard_log);
free(logswitch);
}

Expand Down

0 comments on commit eca2d51

Please sign in to comment.