aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2004-01-07 03:55:41 +0800
committerJP Rosevear <jpr@src.gnome.org>2004-01-07 03:55:41 +0800
commit10fdfe795f82850d8e6dcf1923bc6780eced0763 (patch)
treee1102e651a9595d48070bc0962260ae695ff2794
parent8b2a5cc60d127c0a9a43bc0bcebdddb223537919 (diff)
downloadgsoc2013-evolution-10fdfe795f82850d8e6dcf1923bc6780eced0763.tar.gz
gsoc2013-evolution-10fdfe795f82850d8e6dcf1923bc6780eced0763.tar.zst
gsoc2013-evolution-10fdfe795f82850d8e6dcf1923bc6780eced0763.zip
remove the item from the hash last and don't free its members because the
2004-01-06 JP Rosevear <jpr@ximian.com> * gui/gnome-cal.c (gnome_calendar_add_event_source): remove the item from the hash last and don't free its members because the hash table does that for us (gnome_calendar_remove_event_source): ditto svn path=/trunk/; revision=24078
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/gnome-cal.c14
2 files changed, 12 insertions, 8 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 2690103aab..c5cee12e7d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2004-01-06 JP Rosevear <jpr@ximian.com>
+
+ * gui/gnome-cal.c (gnome_calendar_add_event_source): remove the
+ item from the hash last and don't free its members because the
+ hash table does that for us
+
2004-01-06 Rodrigo Moya <rodrigo@ximian.com>
* gui/calendar-component.c (impl_upgradeFromVersion): new
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 9d5dc3c43d..baf4edc56a 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -2098,13 +2098,12 @@ gnome_calendar_add_event_source (GnomeCalendar *gcal, ESource *source)
/* FIXME Do this async? */
if (!open_ecal (client, FALSE)) {
- g_hash_table_remove (priv->clients, str_uri);
priv->clients_list = g_list_remove (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
- g_free (str_uri);
- g_object_unref (client);
+ /* Do this last because it unrefs the client */
+ g_hash_table_remove (priv->clients, str_uri);
return FALSE;
}
@@ -2137,8 +2136,8 @@ gnome_calendar_remove_event_source (GnomeCalendar *gcal, ESource *source)
{
GnomeCalendarPrivate *priv;
ECal *client;
+ char *str_uri;
int i;
- char *str_uri, *orig_uri;
g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
@@ -2147,12 +2146,12 @@ gnome_calendar_remove_event_source (GnomeCalendar *gcal, ESource *source)
priv = gcal->priv;
str_uri = e_source_get_uri (source);
- if (!g_hash_table_lookup_extended (priv->clients, str_uri, &orig_uri, &client)) {
+ client = g_hash_table_lookup (priv->clients, str_uri);
+ if (!client) {
g_free (str_uri);
return TRUE;
}
- g_hash_table_remove (priv->clients, orig_uri);
priv->clients_list = g_list_remove (priv->clients_list, client);
g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, gcal);
@@ -2164,9 +2163,8 @@ gnome_calendar_remove_event_source (GnomeCalendar *gcal, ESource *source)
e_cal_model_remove_client (model, client);
}
- g_free (orig_uri);
+ g_hash_table_remove (priv->clients, str_uri);
g_free (str_uri);
- g_object_unref (client);
/* update date navigator query */
update_query (gcal);