From 34bd7b09846f80dd879dc554b7c79e0512a7d1a8 Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Wed, 26 Feb 2003 21:58:43 +0000 Subject: Fixes Ximian #38306. 2003-02-26 Hans Petter Jansson Fixes Ximian #38306. * gui/e-itip-control.c (clean_up): Do nothing if the private structure has been freed. Don't call non-g_free() freers with NULL pointers. (destroy): Do nothing if the private structure has been freed. Clear pointers to freed blocks. svn path=/trunk/; revision=20077 --- calendar/gui/e-itip-control.c | 54 ++++++++++++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 19 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index a540a65bef..945824797c 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -330,18 +330,26 @@ clean_up (EItipControl *itip) EItipControlPrivate *priv; priv = itip->priv; + if (!priv) + return; g_free (priv->vcalendar); priv->vcalendar = NULL; - if (priv->comp) + if (priv->comp) { g_object_unref (priv->comp); - priv->comp = NULL; + priv->comp = NULL; + } + + if (priv->top_level) { + icalcomponent_free (priv->top_level); + priv->top_level = NULL; + } - icalcomponent_free (priv->top_level); - priv->top_level = NULL; - icalcomponent_free (priv->main_comp); - priv->main_comp = NULL; + if (priv->main_comp) { + icalcomponent_free (priv->main_comp); + priv->main_comp = NULL; + } priv->ical_comp = NULL; priv->current = 0; @@ -369,22 +377,30 @@ destroy (GtkObject *obj) priv = itip->priv; - clean_up (itip); + if (priv) { + clean_up (itip); - priv->accounts = NULL; + priv->accounts = NULL; - if (priv->event_clients) { - for (i = 0; i < priv->event_clients->len; i++) - g_object_unref (g_ptr_array_index (priv->event_clients, i)); - g_ptr_array_free (priv->event_clients, TRUE); - } - if (priv->task_clients) { - for (i = 0; i < priv->task_clients->len; i++) - g_object_unref (g_ptr_array_index (priv->task_clients, i)); - g_ptr_array_free (priv->task_clients, TRUE); - } + if (priv->event_clients) { + for (i = 0; i < priv->event_clients->len; i++) + g_object_unref (g_ptr_array_index (priv->event_clients, i)); + g_ptr_array_free (priv->event_clients, TRUE); + priv->event_client = NULL; + priv->event_clients = NULL; + } - g_free (priv); + if (priv->task_clients) { + for (i = 0; i < priv->task_clients->len; i++) + g_object_unref (g_ptr_array_index (priv->task_clients, i)); + g_ptr_array_free (priv->task_clients, TRUE); + priv->task_client = NULL; + priv->task_clients = NULL; + } + + g_free (priv); + itip->priv = NULL; + } if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (obj); -- cgit v1.2.3