]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
idnode list mapping: fix the channel-service save on shutdown
authorJaroslav Kysela <perex@perex.cz>
Tue, 16 Jun 2015 13:55:17 +0000 (15:55 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Jun 2015 13:55:17 +0000 (15:55 +0200)
src/access.c
src/channels.c
src/service.c

index 9b539a9074b5ebe12a0b1fa7949bf42ec3f3e207..5500cbb73d64040fb83250152ea4eb73233b39d4 100644 (file)
@@ -995,7 +995,7 @@ access_entry_destroy(access_entry_t *ae)
 void
 access_destroy_by_profile(profile_t *pro, int delconf)
 {
-  idnode_list_destroy(&pro->pro_accesses, pro);
+  idnode_list_destroy(&pro->pro_accesses, delconf ? pro : NULL);
 }
 
 /*
@@ -1004,7 +1004,7 @@ access_destroy_by_profile(profile_t *pro, int delconf)
 void
 access_destroy_by_dvr_config(dvr_config_t *cfg, int delconf)
 {
-  idnode_list_destroy(&cfg->dvr_accesses, cfg);
+  idnode_list_destroy(&cfg->dvr_accesses, delconf ? cfg : NULL);
 }
 
 /*
@@ -1013,7 +1013,7 @@ access_destroy_by_dvr_config(dvr_config_t *cfg, int delconf)
 void
 access_destroy_by_channel_tag(channel_tag_t *ct, int delconf)
 {
-  idnode_list_destroy(&ct->ct_accesses, ct);
+  idnode_list_destroy(&ct->ct_accesses, delconf ? ct : NULL);
 }
 
 /**
index 8ad4db99b9d2625eec8c6cf8c00c1a7fd5988ced..56da02a44d40168e4b8426ab1bcaec1127a0db25 100644 (file)
@@ -752,7 +752,7 @@ channel_delete ( channel_t *ch, int delconf )
 
   /* Tags */
   while((ilm = LIST_FIRST(&ch->ch_ctms)) != NULL)
-    channel_tag_mapping_destroy(ilm, ch);
+    channel_tag_mapping_destroy(ilm, delconf ? ch : NULL);
 
   /* DVR */
   autorec_destroy_by_channel(ch, delconf);
@@ -761,7 +761,7 @@ channel_delete ( channel_t *ch, int delconf )
 
   /* Services */
   while((ilm = LIST_FIRST(&ch->ch_services)) != NULL)
-    idnode_list_unlink(ilm, ch);
+    idnode_list_unlink(ilm, delconf ? ch : NULL);
 
   /* Subscriptions */
   while((s = LIST_FIRST(&ch->ch_subscriptions)) != NULL) {
@@ -944,11 +944,11 @@ channel_tag_destroy(channel_tag_t *ct, int delconf)
 {
   idnode_list_mapping_t *ilm;
 
-  if (delconf) {
-    while((ilm = LIST_FIRST(&ct->ct_ctms)) != NULL)
-      channel_tag_mapping_destroy(ilm, ilm->ilm_in1);
+  while((ilm = LIST_FIRST(&ct->ct_ctms)) != NULL)
+    channel_tag_mapping_destroy(ilm, delconf ? ilm->ilm_in1 : NULL);
+
+  if (delconf)
     hts_settings_remove("channel/tag/%s", idnode_uuid_as_str(&ct->ct_id));
-  }
 
   if(ct->ct_enabled && !ct->ct_internal)
     htsp_tag_delete(ct);
index 373c724d6c79477d25da2b80126dab9641b70fde..313db0be8856054c0954057c14b1fb9156ccebc4 100644 (file)
@@ -811,12 +811,11 @@ service_destroy(service_t *t, int delconf)
   
   service_mapper_remove(t);
 
-  while((s = LIST_FIRST(&t->s_subscriptions)) != NULL) {
+  while((s = LIST_FIRST(&t->s_subscriptions)) != NULL)
     subscription_unlink_service(s, SM_CODE_SOURCE_DELETED);
-  }
 
   while ((ilm = LIST_FIRST(&t->s_channels)))
-    idnode_list_unlink(ilm, t);
+    idnode_list_unlink(ilm, delconf ? t : NULL);
 
   idnode_unlink(&t->s_id);