From 300b6beaf106c8fb89eb5da31ca327e7d68ec8b0 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 12 Jun 2023 17:19:00 -0700 Subject: modules/rtv: gc module contexts on channel switch This probably needs more work, but this at a minimum should prevent us from leaking contexts in the stream at the myriad paths we construct them at. Context registration replaces what's at the existing path, but rtv produces all sorts of setup paths, and I haven't added any explicit unregistration of contexts at this time. That might change, but for now let's just use this gc mechanism even if it's a temporary hack. --- src/modules/rtv/rtv.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/modules/rtv') diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c index 9f7470b..12f5580 100644 --- a/src/modules/rtv/rtv.c +++ b/src/modules/rtv/rtv.c @@ -7,6 +7,7 @@ #include "til_fb.h" #include "til_module_context.h" #include "til_settings.h" +#include "til_stream.h" #include "til_util.h" #include "txt/txt.h" @@ -218,6 +219,8 @@ static void setup_next_channel(rtv_context_t *ctxt, unsigned ticks) if (!ctxt->channel->module_ctxt) (void) til_module_create_context(ctxt->channel->module, ctxt->til_module_context.stream, rand_r(&ctxt->til_module_context.seed), ticks, ctxt->til_module_context.n_cpus, ctxt->channel->module_setup, &ctxt->channel->module_ctxt); + til_stream_gc_module_contexts(ctxt->til_module_context.stream); + ctxt->channel->last_on_time = now; } -- cgit v1.2.1