aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util/calobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-util/calobj.c')
-rw-r--r--calendar/cal-util/calobj.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index cc9c1636c7..9691d31c11 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -66,6 +66,8 @@ ical_object_new (void)
ico->pilot_id = 0;
ico->pilot_status = ICAL_PILOT_SYNC_MOD;
+ ico->ref_count = 1;
+
return ico;
}
@@ -91,6 +93,23 @@ ical_new (char *comment, char *organizer, char *summary)
return ico;
}
+
+void
+ical_object_ref (iCalObject *ico)
+{
+ ico->ref_count++;
+}
+
+
+void
+ical_object_unref (iCalObject *ico)
+{
+ ico->ref_count--;
+ if (ico->ref_count == 0)
+ ical_object_destroy (ico);
+}
+
+
static void
my_free (gpointer data, gpointer user_dat_ignored)
{
@@ -588,6 +607,8 @@ ical_object_create_from_vobject (VObject *o, const char *object_name)
return 0;
}
+ ical->ref_count = 1;
+
/* uid */
if (has (o, VCUniqueStringProp)){
ical->uid = g_strdup (str_val (vo));