From: Jaroslav Kysela Date: Tue, 6 Jun 2017 17:39:57 +0000 (+0200) Subject: channel: avoid recursive changed callback calls, fixes #4408 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f367aba85161013c642c4ed2a1e775a2384557e9;p=thirdparty%2Ftvheadend.git channel: avoid recursive changed callback calls, fixes #4408 --- diff --git a/src/channels.c b/src/channels.c index 74677fe6d..3f76b9231 100644 --- a/src/channels.c +++ b/src/channels.c @@ -73,6 +73,9 @@ channel_class_changed ( idnode_t *self ) { channel_t *ch = (channel_t *)self; + if (atomic_add(&ch->ch_changed_ref, 1) > 0) + goto end; + tvhdebug(LS_CHANNEL, "channel '%s' changed", channel_get_name(ch, channel_blank_name)); /* update the EPG channel <-> channel mapping here */ @@ -81,6 +84,9 @@ channel_class_changed ( idnode_t *self ) /* HTSP */ htsp_channel_update(ch); + +end: + atomic_dec(&ch->ch_changed_ref, 0); } static htsmsg_t * @@ -1009,6 +1015,8 @@ channel_create0 ch->ch_epgauto = 1; ch->ch_epg_running = -1; + atomic_set(&ch->ch_changed_ref, 0); + if (conf) { ch->ch_load = 1; idnode_load(&ch->ch_id, conf); diff --git a/src/channels.h b/src/channels.h index 357281df4..430252b25 100644 --- a/src/channels.h +++ b/src/channels.h @@ -46,6 +46,7 @@ typedef struct channel int ch_refcount; int ch_load; int ch_dont_save; + int ch_changed_ref; /* Channel info */ int ch_enabled;