diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-08-13 23:33:12 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-08-13 23:33:12 -0700 |
commit | 5f7d8416c6616b452a02ff5d85e59d923af66e8f (patch) | |
tree | acccf994710eedf999fdb41281e072212c516696 /src/modules/rtv | |
parent | bcfe4d6daf020c9c68c6755a4ae7c25b74625d9c (diff) |
modules/rtv: don't gc from cleanup_channel()
cleanup_channel() is called from rtv_destroy_context(), which
can be called by a gc. The gc isn't reentrant and generally
isn't expecting this, so it breaks in hilarious ways when this
happens, usually ending in a segfault.
gc should probably get some defenses for asserting on reentry...
for now let's just prevent crashing by removing the gc call from
the destroy path.
Diffstat (limited to 'src/modules/rtv')
-rw-r--r-- | src/modules/rtv/rtv.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index bfd4e57..5853296 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -137,8 +137,6 @@ static void cleanup_channel(rtv_context_t *ctxt) ctxt->channel->settings_as_arg = NULL; ctxt->caption = ctxt->channel->caption = txt_free(ctxt->channel->caption); - - til_stream_gc_module_contexts(ctxt->til_module_context.stream); } @@ -151,8 +149,13 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks) */ if (ctxt->channel) { ctxt->channel->cumulative_time += now - ctxt->channel->last_on_time; - if (ctxt->channel->cumulative_time >= ctxt->context_duration) + if (ctxt->channel->cumulative_time >= ctxt->context_duration) { cleanup_channel(ctxt); + /* XXX: gc used to be part of cleanup_channel(), but rtv_destroy_context() uses it + * as well, creating a potential recursive gc and things go boom. + */ + til_stream_gc_module_contexts(ctxt->til_module_context.stream); + } } if (!ctxt->n_channels || |