aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal-backend-file.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-09-13 22:26:56 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-09-13 22:26:56 +0800
commit56d23d7d0387a57c90542eb438aa1d9f25de53b4 (patch)
tree2c7a5af17fb98c80b5123c1844bd62fd493fb1a0 /calendar/pcs/cal-backend-file.c
parent2ceccf9c7138ed533aabbf3244fec43da833785f (diff)
downloadgsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.tar
gsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.tar.gz
gsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.tar.bz2
gsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.tar.lz
gsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.tar.xz
gsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.tar.zst
gsoc2013-evolution-56d23d7d0387a57c90542eb438aa1d9f25de53b4.zip
Only remove the pilot item from the hash if it exists in the first place.
2000-09-13 JP Rosevear <jpr@helixcode.com> * pcs/cal-backend-file.c (remove_component): Only remove the pilot item from the hash if it exists in the first place. svn path=/trunk/; revision=5399
Diffstat (limited to 'calendar/pcs/cal-backend-file.c')
-rw-r--r--calendar/pcs/cal-backend-file.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 078415fa02..06b75d52a6 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -473,7 +473,6 @@ add_component (CalBackendFile *cbfile, CalComponent *comp, gboolean add_to_tople
CalBackendFilePrivate *priv;
GList **list;
const char *uid;
- gchar *key;
unsigned long *pilot_id;
priv = cbfile->priv;
@@ -501,14 +500,13 @@ add_component (CalBackendFile *cbfile, CalComponent *comp, gboolean add_to_tople
*/
check_dup_uid (cbfile, comp);
cal_component_get_uid (comp, &uid);
- key = g_strdup (uid);
- g_hash_table_insert (priv->comp_uid_hash, key, comp);
+ g_hash_table_insert (priv->comp_uid_hash, (char *)uid, comp);
/* Update the pilot list, if there is a pilot id */
cal_component_get_pilot_id (comp, &pilot_id);
if (pilot_id)
g_hash_table_insert (priv->comp_pilot_hash,
- pilot_id, (char *)key);
+ pilot_id, (char *)uid);
*list = g_list_prepend (*list, comp);
@@ -549,9 +547,10 @@ remove_component (CalBackendFile *cbfile, CalComponent *comp)
/* Remove it from our mapping */
cal_component_get_uid (comp, &uid);
- cal_component_get_pilot_id (comp, &pilot_id);
g_hash_table_remove (priv->comp_uid_hash, uid);
- g_hash_table_remove (priv->comp_pilot_hash, pilot_id);
+ cal_component_get_pilot_id (comp, &pilot_id);
+ if (pilot_id)
+ g_hash_table_remove (priv->comp_pilot_hash, pilot_id);
switch (cal_component_get_vtype (comp)) {
case CAL_COMPONENT_EVENT: