aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-10-07 23:52:21 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-10-07 23:52:21 +0800
commitbda9596690687aab710bcb9e2ff89abd3b098618 (patch)
treee5b2c2a4f44d84ef060c49a027b252eb97aa4482
parentc098c90ebb80d4072ac1ebabc26204fd0067a4b1 (diff)
downloadgsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.tar
gsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.tar.gz
gsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.tar.bz2
gsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.tar.lz
gsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.tar.xz
gsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.tar.zst
gsoc2013-evolution-bda9596690687aab710bcb9e2ff89abd3b098618.zip
Fixes crash in #19159
2002-10-07 Rodrigo Moya <rodrigo@ximian.com> Fixes crash in #19159 * gui/alarm-notify/alarm-queue.c (lookup_queued_alarm): don't crash if we don't find the queued alarm in the internal list. (alarm_trigger_cb, create_snooze, display_notification, audio_notification, procedure_notification, remove_queued_alarm): check return value from lookup_queued_alarm. svn path=/trunk/; revision=18331
-rw-r--r--calendar/ChangeLog10
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c20
2 files changed, 23 insertions, 7 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 330373f4ed..0d6d9db31d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,13 @@
+2002-10-07 Rodrigo Moya <rodrigo@ximian.com>
+
+ Fixes crash in #19159
+
+ * gui/alarm-notify/alarm-queue.c (lookup_queued_alarm): don't crash if
+ we don't find the queued alarm in the internal list.
+ (alarm_trigger_cb, create_snooze, display_notification,
+ audio_notification, procedure_notification, remove_queued_alarm):
+ check return value from lookup_queued_alarm.
+
2002-10-04 Rodrigo Moya <rodrigo@ximian.com>
Fixes #15892
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index faa0475cf4..6782c91a2d 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -182,11 +182,11 @@ lookup_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id)
for (l = cqa->queued_alarms; l; l = l->next) {
qa = l->data;
if (qa->alarm_id == alarm_id)
- break;
+ return qa;
}
- g_assert (l != NULL);
- return qa;
+ /* not found, might have been updated/removed */
+ return NULL;
}
/* Removes an alarm from the list of alarms of a component. If the alarm was
@@ -207,7 +207,8 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id)
break;
}
- g_assert (l != NULL);
+ if (!l)
+ return;
cqa->queued_alarms = g_slist_remove_link (cqa->queued_alarms, l);
g_slist_free_1 (l);
@@ -247,6 +248,8 @@ alarm_trigger_cb (gpointer alarm_id, time_t trigger, gpointer data)
save_notification_time (trigger);
qa = lookup_queued_alarm (cqa, alarm_id);
+ if (!qa)
+ return;
/* Decide what to do based on the alarm action. We use the trigger that
* is passed to us instead of the one from the instance structure
@@ -642,7 +645,8 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
comp = cqa->alarms->comp;
qa = lookup_queued_alarm (cqa, alarm_id);
- g_assert (qa != NULL);
+ if (!qa)
+ return;
vtype = cal_component_get_vtype (comp);
@@ -699,7 +703,8 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
comp = cqa->alarms->comp;
qa = lookup_queued_alarm (cqa, alarm_id);
- g_assert (qa != NULL);
+ if (!qa)
+ return;
alarm = cal_component_get_alarm (comp, qa->instance->auid);
g_assert (alarm != NULL);
@@ -798,7 +803,8 @@ procedure_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id
comp = cqa->alarms->comp;
qa = lookup_queued_alarm (cqa, alarm_id);
- g_assert (qa != NULL);
+ if (!qa)
+ return;
alarm = cal_component_get_alarm (comp, qa->instance->auid);
g_assert (alarm != NULL);