aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/gui/alarm-notify/alarm.c27
2 files changed, 29 insertions, 6 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 573dcb979d..d394011bd4 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,11 @@
+2007-08-06 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Fix for bug #454253
+
+ * gui/alarm-notify/alarm.c: (pop_alarm), (alarm_ready_cb),
+ (setup_timeout), (alarm_done): Fail safe instead of crash, when it is
+ not really required to crash.
+
2007-08-03 Hiroyuki Ikezoe <poincare@ikezoe.net>
** Fix for bug #377173
diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c
index b360075d13..13dca9ca77 100644
--- a/calendar/gui/alarm-notify/alarm.c
+++ b/calendar/gui/alarm-notify/alarm.c
@@ -56,7 +56,10 @@ pop_alarm (void)
AlarmRecord *ar;
GList *l;
- g_assert (alarms != NULL);
+ if (!alarms) {
+ g_warning ("Nothing to pop from the alarm queue");
+ return;
+ }
ar = alarms->data;
@@ -72,7 +75,11 @@ alarm_ready_cb (gpointer data)
{
time_t now;
- g_assert (alarms != NULL);
+ if (!alarms) {
+ g_warning ("Alarm triggered, but no alarm present\n");
+ return FALSE;
+ }
+
timeout_id = 0;
now = time (NULL);
@@ -120,7 +127,11 @@ setup_timeout (void)
const AlarmRecord *ar;
guint diff;
time_t now;
- g_assert (alarms != NULL);
+
+ if (!alarms) {
+ g_warning ("No alarm to setup\n");
+ return;
+ }
ar = alarms->data;
@@ -273,15 +284,19 @@ alarm_done (void)
GList *l;
if (timeout_id == 0) {
- g_assert (alarms == NULL);
+ if (alarms)
+ g_warning ("No timeout, but queue is not NULL\n");
return;
}
- g_assert (alarms != NULL);
-
g_source_remove (timeout_id);
timeout_id = 0;
+ if (!alarms) {
+ g_warning ("timeout present, freed, but no alarms active\n");
+ return;
+ }
+
for (l = alarms; l; l = l->next) {
AlarmRecord *ar;