summaryrefslogtreecommitdiff
path: root/mate-session/gs-idle-monitor.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-07 12:47:32 +0100
committerinfirit <[email protected]>2014-11-07 14:31:51 +0100
commit1d7816517e0ac5a7f74ce51b2af9178b8dc91388 (patch)
treeb57470326f81c11966c1f522bd049b4bc2dd5722 /mate-session/gs-idle-monitor.c
parentccfc0f67de5e6b15a1c7e33f45c671bc2cebd4b4 (diff)
downloadmate-session-manager-1d7816517e0ac5a7f74ce51b2af9178b8dc91388.tar.bz2
mate-session-manager-1d7816517e0ac5a7f74ce51b2af9178b8dc91388.tar.xz
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 <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=627903
Diffstat (limited to 'mate-session/gs-idle-monitor.c')
-rw-r--r--mate-session/gs-idle-monitor.c1
1 files changed, 1 insertions, 0 deletions
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",