Unlink xrefs properly when struct is deleted.
[gedcom-parse.git] / gom / family_link.c
index cb266b209d25e03621cc217549140f457720ded2..cb5435be90781d1f18c3726236479e3da24319de 100644 (file)
@@ -98,6 +98,16 @@ void family_link_subscribe()
                              def_elt_end);
 }
 
+void UNREFALLFUNC(pedigree)(struct pedigree* obj)
+{
+  if (obj) {
+    struct pedigree* runner;
+    for (runner = obj; runner; runner = runner->next) {
+      UNREFALLFUNC(user_data)(runner->extra);
+    }
+  }
+}
+
 void CLEANFUNC(pedigree)(struct pedigree* ped)
 {
   if (ped) {
@@ -105,6 +115,19 @@ void CLEANFUNC(pedigree)(struct pedigree* ped)
   }
 }
 
+void UNREFALLFUNC(family_link)(struct family_link* obj)
+{
+  if (obj) {
+    struct family_link* runner;
+    for (runner = obj; runner; runner = runner->next) {
+      unref_xref_value(runner->family);
+      UNREFALLFUNC(pedigree)(runner->pedigree);
+      UNREFALLFUNC(note_sub)(runner->note);
+      UNREFALLFUNC(user_data)(runner->extra);
+    }
+  }
+}
+
 void CLEANFUNC(family_link)(struct family_link *link)
 {
   if (link) {