diff options
author | Alfred Peng <alfred.peng@sun.com> | 2004-03-18 14:38:35 +0800 |
---|---|---|
committer | Jack Jia <jackjia@src.gnome.org> | 2004-03-18 14:38:35 +0800 |
commit | 7ff47f45a22a51fee075cf4a40b434159c6893a6 (patch) | |
tree | c97646e5e04faa80bc5dd29fc7624939ce11d406 /calendar | |
parent | d88fb93892dab396b104113f7dcdf9c7f621d4b3 (diff) | |
download | gsoc2013-evolution-7ff47f45a22a51fee075cf4a40b434159c6893a6.tar.gz gsoc2013-evolution-7ff47f45a22a51fee075cf4a40b434159c6893a6.tar.zst gsoc2013-evolution-7ff47f45a22a51fee075cf4a40b434159c6893a6.zip |
Fix #51187 on bugzilla of ximian If "alarms" or "alarms->alarms" is NULL
2004-03-18 Alfred Peng <alfred.peng@sun.com>
* Fix #51187 on bugzilla of ximian
* gui/alarm-notify/alarm-queue.c (query_objects_changed_cb):
If "alarms" or "alarms->alarms" is NULL after querying a calendar
for the alarms of a particular object, the reuse of "cqa" will
probably cause evolution-alarm-notify to crash.
So remove "cqa" when "alarms" or "alarms->alarms" is NULL. Otherwise
update it.
svn path=/trunk/; revision=25112
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 63 |
2 files changed, 43 insertions, 30 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 7965253e1d..8dbb13b5c4 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2004-03-18 Alfred Peng <alfred.peng@sun.com> + + * Fix #51187 on bugzilla of ximian + * gui/alarm-notify/alarm-queue.c (query_objects_changed_cb): + If "alarms" or "alarms->alarms" is NULL after querying a calendar + for the alarms of a particular object, the reuse of "cqa" will + probably cause evolution-alarm-notify to crash. + So remove "cqa" when "alarms" or "alarms->alarms" is NULL. Otherwise + update it. + 2004-03-17 hpnadig <hp@ndeepak.info> * gui/dialogs/task-page.glade: Capitalized words changed. Solves 48115. diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 0ad2f4c1fe..85bc818f55 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -547,39 +547,42 @@ query_objects_changed_cb (ECal *client, GList *objects, gpointer data) else { GSList *sl; - /* if already in the list, just update it */ - remove_alarms (cqa, FALSE); - cqa->alarms = alarms; - cqa->queued_alarms = NULL; - - /* add the new alarms */ - for (sl = cqa->alarms->alarms; sl; sl = sl->next) { - ECalComponentAlarmInstance *instance; - gpointer alarm_id; - QueuedAlarm *qa; - - instance = sl->data; - - alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL); - if (!alarm_id) { - g_message ("obj_updated_cb(): Could not schedule a trigger for " - "%ld, discarding...", (long) instance->trigger); - continue; - } - - qa = g_new (QueuedAlarm, 1); - qa->alarm_id = alarm_id; - qa->instance = instance; - qa->snooze = FALSE; - - cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa); + /* if the alarms or the alarms list is empty, just remove it */ + if (alarms == NULL || alarms->alarms == NULL) { + if (alarms) + e_cal_component_alarms_free (alarms); } + else { + /* if already in the list, just update it */ + remove_alarms (cqa, FALSE); + cqa->alarms = alarms; + cqa->queued_alarms = NULL; + + /* add the new alarms */ + for (sl = cqa->alarms->alarms; sl; sl = sl->next) { + ECalComponentAlarmInstance *instance; + gpointer alarm_id; + QueuedAlarm *qa; + + instance = sl->data; + + alarm_id = alarm_add (instance->trigger, alarm_trigger_cb, cqa, NULL); + if (!alarm_id) { + g_message ("obj_updated_cb(): Could not schedule a trigger for " + "%ld, discarding...", (long) instance->trigger); + continue; + } + + qa = g_new (QueuedAlarm, 1); + qa->alarm_id = alarm_id; + qa->instance = instance; + qa->snooze = FALSE; + + cqa->queued_alarms = g_slist_prepend (cqa->queued_alarms, qa); + } - if (cqa->queued_alarms == NULL) { - if (!cqa->expecting_update) - remove_comp (ca, uid); - } else cqa->queued_alarms = g_slist_reverse (cqa->queued_alarms); + } } } } |