diff options
author | Colin Walters <walters@verbum.org> | 2011-10-03 16:35:20 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2011-10-03 16:37:28 -0400 |
commit | 311476792ba7948f0eba5e4d9a1328cf3ff18950 (patch) | |
tree | 14e3762da0e88daa1cf0cf160f7dac5394e86d04 | |
parent | 55daaf0972c0021a20624dcd16df5e14cca5d430 (diff) | |
download | gnome-desktop-311476792ba7948f0eba5e4d9a1328cf3ff18950.tar.gz |
GnomeWallClock: Fix non-Linux fallback code
This fixes the "infinite loop in gnome-screensaver" bug. Only
dispatch in cancel on set when the monotonic timeout has expired,
otherwise we will drop into a tight loop.
https://bugzilla.gnome.org/show_bug.cgi?id=660343
-rw-r--r-- | libgnome-desktop/gnome-datetime-source.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libgnome-desktop/gnome-datetime-source.c b/libgnome-desktop/gnome-datetime-source.c index 05ec80a1..a35d5b3b 100644 --- a/libgnome-desktop/gnome-datetime-source.c +++ b/libgnome-desktop/gnome-datetime-source.c @@ -57,8 +57,10 @@ static gboolean g_datetime_source_is_expired (GDateTimeSource *datetime_source) { gint64 real_now; + gint64 monotonic_now; real_now = g_get_real_time (); + monotonic_now = g_source_get_time ((GSource*)datetime_source); if (datetime_source->initially_expired) return TRUE; @@ -66,10 +68,11 @@ g_datetime_source_is_expired (GDateTimeSource *datetime_source) if (datetime_source->real_expiration <= real_now) return TRUE; - /* We can't really detect without system support when things change; - * so just trigger every second. + /* We can't really detect without system support when things + * change; so just trigger every second (i.e. our wakeup + * expiration) */ - if (datetime_source->cancel_on_set) + if (datetime_source->cancel_on_set && monotonic_now >= datetime_source->wakeup_expiration) return TRUE; return FALSE; |