[PATCH v2] Update currentTime in dispatch loop

Chase Douglas chase.douglas at canonical.com
Wed Apr 18 18:36:12 PDT 2012


A request, like input device grabs, may check a request timestamp
against currentTime. It is possible for currentTime to lag a previously
sent event timestamp. If the client makes a request based on such an
event timestamp, the request may fail the validity check against
currentTime unless we always update the time before processing the
request.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
Changes from v1:
* Move the update deeper in the function to inner loops, right before we
  read the requests from clients. There cannot be any calls to
  ProcessInputEvents in between the currentTime update and request
  handling.

 dix/dispatch.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index bce3a0d..9a2e22f 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -393,6 +393,9 @@ Dispatch(void)
                 }
                 /* now, finally, deal with client requests */
 
+                /* Update currentTime so request time checks, such as for input
+                 * device grabs, are calculated correctly */
+                UpdateCurrentTimeIf();
                 result = ReadRequestFromClient(client);
                 if (result <= 0) {
                     if (result < 0)
-- 
1.7.9.1



More information about the xorg-devel mailing list