From 8b7c7e807f58b351e76a6a0733758875363ad37b Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 25 Sep 2001 20:25:03 +0000 Subject: Check that the timeout is not set up before we create a new one; the 2001-09-25 Federico Mena Quintero * gui/alarm-notify/alarm.c (alarm_ready_cb): Check that the timeout is not set up before we create a new one; the alarm_fn callback may cause the alarm system to re-enter and add a new alarm. Fixes bug #10840. (pop_alarm): Assert that there is at least one alarm in the queue. svn path=/trunk/; revision=13117 --- calendar/gui/alarm-notify/alarm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'calendar/gui/alarm-notify/alarm.c') diff --git a/calendar/gui/alarm-notify/alarm.c b/calendar/gui/alarm-notify/alarm.c index 7f45a72712..8ee5146230 100644 --- a/calendar/gui/alarm-notify/alarm.c +++ b/calendar/gui/alarm-notify/alarm.c @@ -57,8 +57,7 @@ pop_alarm (void) AlarmRecord *ar; GList *l; - if (!alarms) - return; + g_assert (alarms != NULL); ar = alarms->data; @@ -102,8 +101,15 @@ alarm_ready_cb (gpointer data) (* ar->destroy_notify_fn) (notify_id, ar->data); } - if (alarms) - setup_timeout (now); + if (alarms) { + /* We need this check because one of the alarm_fn above may have + * re-entered and added an alarm of its own, so the timer will + * already be set up. + */ + if (timeout_id != 0) + setup_timeout (now); + } else + g_assert (timeout_id == 0); return FALSE; } -- cgit v1.2.3