Fix event race
authorDaniel Colascione <dancol@dancol.org>
Mon, 24 Feb 2014 14:27:37 +0000 (06:27 -0800)
committerDaniel Colascione <dancol@dancol.org>
Mon, 24 Feb 2014 14:27:37 +0000 (06:27 -0800)
1  2 
src/ChangeLog
src/keyboard.c

diff --cc src/ChangeLog
@@@ -1,31 -1,3 +1,35 @@@
++2014-02-24  Daniel Colascione  <dancol@dancol.org>
++
++      * keyboard.c (read_char): Close race that resulted in lost events.
++
 +2014-02-22  Glenn Morris  <rgm@gnu.org>
 +
 +      * frame.c (frame-alpha-lower-limit, frame-resize-pixelwise):
 +      * window.c (window-resize-pixelwise): Doc fixes.
 +
 +      * process.c (Finternal_default_process_filter)
 +      (Finternal_default_process_sentinel): Doc tweaks.
 +
 +2014-02-21  Glenn Morris  <rgm@gnu.org>
 +
 +      * process.c (Fprocess_buffer, Faccept_process_output)
 +      (Finternal_default_process_filter, Finternal_default_process_sentinel):
 +      Doc fixes.
 +
 +2014-02-21  Martin Rudalics  <rudalics@gmx.at>
 +
 +      * window.c (Fwindow_scroll_bar_width): New function.
 +
 +2014-02-21  Paul Eggert  <eggert@cs.ucla.edu>
 +
 +      Pacify GCC when configuring with --enable-gcc-warnings.
 +      * xdisp.c (move_it_in_display_line_to) [lint]:
 +      Initialize recently-added local.
 +
 +2014-02-21  Daniel Colascione  <dancol@dancol.org>
 +
 +      * dbusbind.c: Rename dbus-init-bus to dbus-init-bus-1.
 +
  2014-02-20  Eli Zaretskii  <eliz@gnu.org>
  
        * xdisp.c (init_iterator): Don't dereference a bogus face
diff --cc src/keyboard.c
@@@ -2891,8 -2891,8 +2891,12 @@@ read_char (int commandflag, Lisp_Objec
      {
        c = read_decoded_event_from_main_queue (end_time, local_getcjmp,
                                                prev_event, used_mouse_menu);
--      if (end_time && timespec_cmp (*end_time, current_timespec ()) <= 0)
--        goto exit;
++      if (NILP(c) && end_time &&
++          timespec_cmp (*end_time, current_timespec ()) <= 0)
++        {
++          goto exit;
++        }
++
        if (EQ (c, make_number (-2)))
          {
          /* This is going to exit from read_char