From 6e8d87276c60eb9c460232ba4ce38526f3c72e9e Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 6 Aug 2001 17:25:53 +0000 Subject: added check for NULL pointers. Maybe fixes #5203 (I can't reproduce it, so 2001-08-06 Rodrigo Moya * cal-client/cal-client.c (destroy_wombat_client): added check for NULL pointers. Maybe fixes #5203 (I can't reproduce it, so I'm not sure) svn path=/trunk/; revision=11702 --- calendar/ChangeLog | 6 ++++++ calendar/cal-client/cal-client.c | 3 +++ calendar/gui/e-calendar-table.c | 32 +++++++++++++------------------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 7be7b830ef..2c170efb82 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2001-08-06 Rodrigo Moya + + * cal-client/cal-client.c (destroy_wombat_client): added check for + NULL pointers. Maybe fixes #5203 (I can't reproduce it, so I'm not + sure) + 2001-08-03 Federico Mena Quintero * cal-client/query-listener.c (query_listener_stop_notification): diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 4a1a7d2edc..41e42613bb 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -216,6 +216,9 @@ destroy_wombat_client (CalClient *client) { CalClientPrivate *priv; + g_return_if_fail (client != NULL); + g_return_if_fail (IS_CAL_CLIENT (client)); + priv = client->priv; if (!priv->w_client) diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index d49a571608..a1bfa3c597 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -716,8 +716,11 @@ copy_row_cb (int model_row, gpointer data) /* add the new component to the VCALENDAR component */ comp_str = cal_component_get_as_string (comp); child = icalparser_parse_string (comp_str); - if (child) - icalcomponent_add_component (cal_table->tmp_vcal, child); + if (child) { + icalcomponent_add_component (cal_table->tmp_vcal, + icalcomponent_new_clone (child)); + icalcomponent_free (child); + } g_free (comp_str); } @@ -1036,7 +1039,7 @@ selection_received (GtkWidget *invisible, icalcomp = icalparser_parse_string ((const char *) comp_str); if (!icalcomp) return; - + /* check the type of the component */ kind = icalcomponent_isa (icalcomp); if (kind != ICAL_VCALENDAR_COMPONENT && @@ -1047,12 +1050,13 @@ selection_received (GtkWidget *invisible, } if (kind == ICAL_VCALENDAR_COMPONENT) { - int num_found = 0; icalcomponent_kind child_kind; icalcomponent *subcomp; + icalcomponent *vcal_comp; + vcal_comp = icalcomp; subcomp = icalcomponent_get_first_component ( - icalcomp, ICAL_ANY_COMPONENT); + vcal_comp, ICAL_ANY_COMPONENT); while (subcomp) { child_kind = icalcomponent_isa (subcomp); if (child_kind == ICAL_VEVENT_COMPONENT || @@ -1066,24 +1070,14 @@ selection_received (GtkWidget *invisible, tmp_comp, icalcomponent_new_clone (subcomp)); cal_component_set_uid (tmp_comp, uid); + cal_client_update_object ( + calendar_model_get_cal_client (cal_table->model), + tmp_comp); free (uid); gtk_object_unref (GTK_OBJECT (tmp_comp)); - - num_found++; } subcomp = icalcomponent_get_next_component ( - icalcomp, ICAL_ANY_COMPONENT); - } - - if (num_found) { - comp = cal_component_new (); - cal_component_set_icalcomponent (comp, icalcomp); - - cal_client_update_object ( - calendar_model_get_cal_client (cal_table->model), - comp); - - gtk_object_unref (GTK_OBJECT (comp)); + vcal_comp, ICAL_ANY_COMPONENT); } } else { -- cgit v1.2.3