diff -aur ./tvheadend-git/src/dvr/dvr_autorec.c ./tvheadend-git.mod/src/dvr/dvr_autorec.c --- ./tvheadend-git/src/dvr/dvr_autorec.c 2017-12-27 23:04:57.353102838 +0100 +++ ./tvheadend-git.mod/src/dvr/dvr_autorec.c 2017-12-27 23:03:48.123103197 +0100 @@ -74,13 +74,12 @@ static epg_broadcast_t ** dvr_autorec_purge_spawns(dvr_autorec_entry_t *dae, int del, int disabled) { - dvr_entry_t *de; + dvr_entry_t *de, *de_next; epg_broadcast_t **bcast = NULL, **nbcast; int i = 0, size = 0; - while((de = LIST_FIRST(&dae->dae_spawns)) != NULL) { - LIST_REMOVE(de, de_autorec_link); - de->de_autorec = NULL; + for (de = LIST_FIRST(&dae->dae_spawns); de != NULL; de = de_next) { + de_next = LIST_NEXT(de, de_autorec_link); if (!del) continue; if (de->de_sched_state == DVR_SCHEDULED) { if (disabled && !de->de_enabled && de->de_bcast) { @@ -95,12 +94,18 @@ bcast[i++] = de->de_bcast; } } + + LIST_REMOVE(de, de_autorec_link); + de->de_autorec = NULL; dvr_entry_cancel(de, 0); - } else + } else { idnode_changed(&de->de_id); + } } + if (bcast) bcast[i] = NULL; + return bcast; }