emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110828: * keyboard.c (event_to_kboar


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110828: * keyboard.c (event_to_kboard): Do not dereference
Date: Thu, 08 Nov 2012 13:26:40 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110828
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2012-11-08 13:26:40 +0400
message:
  * keyboard.c (event_to_kboard): Do not dereference
  frame_or_window field of SELECTION_REQUEST_EVENT
  and SELECTION_CLEAR_EVENT events (Bug#12814).
  * xterm.h (struct selection_input_event): Adjust comment.
modified:
  src/ChangeLog
  src/keyboard.c
  src/xterm.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-11-07 21:48:18 +0000
+++ b/src/ChangeLog     2012-11-08 09:26:40 +0000
@@ -1,3 +1,10 @@
+2012-11-08  Dmitry Antipov  <address@hidden>
+
+       * keyboard.c (event_to_kboard): Do not dereference
+       frame_or_window field of SELECTION_REQUEST_EVENT
+       and SELECTION_CLEAR_EVENT events (Bug#12814).
+       * xterm.h (struct selection_input_event): Adjust comment.
+
 2012-11-07  Eli Zaretskii  <address@hidden>
 
        * w32fns.c (modifier_set): Don't report modifiers from toggle key,

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-11-02 09:44:08 +0000
+++ b/src/keyboard.c    2012-11-08 09:26:40 +0000
@@ -3416,13 +3416,20 @@
 static KBOARD *
 event_to_kboard (struct input_event *event)
 {
-  Lisp_Object obj = event->frame_or_window;
-  /* There are some events that set this field to nil or string.  */
-  if (WINDOWP (obj))
-    obj = WINDOW_FRAME (XWINDOW (obj));
-  /* Also ignore dead frames here.  */
-  return ((FRAMEP (obj) && FRAME_LIVE_P (XFRAME (obj)))
-         ? FRAME_KBOARD (XFRAME (obj)) : NULL);
+  /* Not applicable for these special events.  */
+  if (event->kind == SELECTION_REQUEST_EVENT
+      || event->kind == SELECTION_CLEAR_EVENT)
+    return NULL;
+  else
+    {
+      Lisp_Object obj = event->frame_or_window;
+      /* There are some events that set this field to nil or string.  */
+      if (WINDOWP (obj))
+       obj = WINDOW_FRAME (XWINDOW (obj));
+      /* Also ignore dead frames here.  */
+      return ((FRAMEP (obj) && FRAME_LIVE_P (XFRAME (obj)))
+             ? FRAME_KBOARD (XFRAME (obj)) : NULL);
+    }
 }
 
 #ifdef subprocesses

=== modified file 'src/xterm.h'
--- a/src/xterm.h       2012-10-07 22:31:58 +0000
+++ b/src/xterm.h       2012-11-08 09:26:40 +0000
@@ -890,10 +890,8 @@
    by this structure.  */
 
 /* For an event of kind SELECTION_REQUEST_EVENT,
-   this structure really describes the contents.
-   **Don't make this struct longer!**
-   If it overlaps the frame_or_window field of struct input_event,
-   that will cause GC to crash.  */
+   this structure really describes the contents.  */
+
 struct selection_input_event
 {
   int kind;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]