[gnome-desktop] GnomeWallClock: Fix non-Linux fallback code
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-desktop] GnomeWallClock: Fix non-Linux fallback code
- Date: Mon, 3 Oct 2011 21:22:24 +0000 (UTC)
commit 7033804a455ccd39997632c164b5fae3e4fedac4
Author: Colin Walters <walters verbum org>
Date: Mon Oct 3 16:35:20 2011 -0400
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
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 05ec80a..a35d5b3 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]