From 1d7816517e0ac5a7f74ce51b2af9178b8dc91388 Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 7 Nov 2014 12:47:32 +0100 Subject: gsm: Fix race condition in idle monitor In _xsync_alarm_set(), the positive and negative transition intervals are set to the same value. However, the SYNC extension defines the positive transition as set when the counter goes from strictly below the threshold to greater than or equal to the threshold and similarly a negative transition is triggered when the counter goes form strictly greater than the threshold to less than or equal to the threshold. Thus in the current set up there's a chance that the positive transition can trigger, marking the session as idle, and some user input occur on the same click so the IDLETIME count will hit the threshold but not go above so the negative transition will not trigger. Thus the session will not be marked as active. The negative transition threshold should be set to 1ms less than the positive transition to ensure that it always fires. Based on gnome-session commit: 861313503a741f0129611ca005cf6d7c27124b54 From: Christopher Halse Rogers Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=627903 --- mate-session/gs-idle-monitor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mate-session/gs-idle-monitor.c b/mate-session/gs-idle-monitor.c index e2d51f0..7d56ac0 100644 --- a/mate-session/gs-idle-monitor.c +++ b/mate-session/gs-idle-monitor.c @@ -448,6 +448,7 @@ _xsync_alarm_set (GSIdleMonitor *monitor, attr.delta = delta; attr.events = TRUE; + attr.trigger.wait_value = _int64_to_xsyncvalue (_xsyncvalue_to_int64 (watch->interval) - 1); attr.trigger.test_type = XSyncPositiveTransition; if (watch->xalarm_positive != None) { g_debug ("GSIdleMonitor: updating alarm for positive transition wait=%ld", -- cgit v1.2.1