diff options
author | Dan Winship <danw@src.gnome.org> | 2004-03-02 06:15:00 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2004-03-02 06:15:00 +0800 |
commit | ff18c9c70d7309713fa4483dd3707e9243b1af1a (patch) | |
tree | d6b9c7c7a3afc0315fc199ad62dd9cb4bb09249e /calendar/gui/alarm-notify | |
parent | c9fb61edde27394c05fd90be3fe4b849da45b15d (diff) | |
download | gsoc2013-evolution-ff18c9c70d7309713fa4483dd3707e9243b1af1a.tar.gz gsoc2013-evolution-ff18c9c70d7309713fa4483dd3707e9243b1af1a.tar.zst gsoc2013-evolution-ff18c9c70d7309713fa4483dd3707e9243b1af1a.zip |
fix rampant double-freeing.
* gui/alarm-notify/alarm-notify.c: fix rampant double-freeing.
svn path=/trunk/; revision=24927
Diffstat (limited to 'calendar/gui/alarm-notify')
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 75d9cb9317..fb18fdc422 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -77,15 +77,11 @@ alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass) } static void -free_client_hash (gpointer key, gpointer value, gpointer user_data) +dequeue_client (gpointer key, gpointer value, gpointer user_data) { - char *uri = key; ECal *client = value; alarm_queue_remove_client (client); - - g_free (uri); - g_object_unref (client); } /* Finalize handler for the alarm notify system */ @@ -101,7 +97,7 @@ alarm_notify_finalize (GObject *object) an = ALARM_NOTIFY (object); priv = an->priv; - g_hash_table_foreach (priv->uri_client_hash, (GHFunc) free_client_hash, NULL); + g_hash_table_foreach (priv->uri_client_hash, dequeue_client, NULL); g_hash_table_destroy (priv->uri_client_hash); g_free (priv); @@ -142,14 +138,8 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data) if (status == E_CALENDAR_STATUS_OK) alarm_queue_add_client (client); else { - gpointer orig_key, orig_value; - - if (g_hash_table_lookup_extended (priv->uri_client_hash, e_cal_get_uri (client), &orig_key, &orig_value)) { - g_hash_table_remove (priv->uri_client_hash, orig_key); - g_free (orig_key); - } - - g_object_unref (client); + g_hash_table_remove (priv->uri_client_hash, + e_cal_get_uri (client)); } } @@ -193,15 +183,13 @@ void alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri) { AlarmNotifyPrivate *priv; - gpointer orig_key, orig_value; + ECal *client; priv = an->priv; - if (g_hash_table_lookup_extended (priv->uri_client_hash, str_uri, &orig_key, &orig_value)) { - alarm_queue_remove_client (E_CAL (orig_value)); - + client = g_hash_table_lookup (priv->uri_client_hash, str_uri); + if (client) { + alarm_queue_remove_client (client); g_hash_table_remove (priv->uri_client_hash, str_uri); - g_free (orig_key); - g_object_unref (orig_value); } } |