emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100380: Avoid crash in Fselect_fr


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100380: Avoid crash in Fselect_frame due to null selected_window (Bug#7728).
Date: Fri, 14 Jan 2011 21:55:58 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100380
author: Martin Rudalics <address@hidden>
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Fri 2011-01-14 21:55:58 -0500
message:
  Avoid crash in Fselect_frame due to null selected_window (Bug#7728).
  
  * window.c (inhibit_point_swap): New variable.
  (Fselect_window): If inhibit_point_swap is nonzero, avoid swapping
  point this time.
  (Fset_window_configuration): Set inhibit_point_swap to 1 instead
  of setting selected_window to nil (Bug#7728).
modified:
  src/ChangeLog
  src/window.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-01-12 02:29:23 +0000
+++ b/src/ChangeLog     2011-01-15 02:55:58 +0000
@@ -1,3 +1,11 @@
+2011-01-15  Martin Rudalics  <address@hidden>
+
+       * window.c (inhibit_point_swap): New variable.
+       (Fselect_window): If inhibit_point_swap is nonzero, avoid swapping
+       point this time.
+       (Fset_window_configuration): Set inhibit_point_swap to 1 instead
+       of setting selected_window to nil (Bug#7728).
+
 2011-01-12  Chong Yidong  <address@hidden>
 
        * config.in (TERMINFO): New definition.

=== modified file 'src/window.c'
--- a/src/window.c      2011-01-02 23:50:46 +0000
+++ b/src/window.c      2011-01-15 02:55:58 +0000
@@ -158,6 +158,11 @@
 
 static int window_initialized;
 
+/* Set in `set-window-configuration' to prevent "swapping out point"
+   in the old selected window.  */
+
+static int inhibit_point_swap;
+
 /* Hook to run when window config changes.  */
 
 static Lisp_Object Qwindow_configuration_change_hook;
@@ -186,11 +191,6 @@
 static int window_scroll_preserve_hpos;
 static int window_scroll_preserve_vpos;
 
-#if 0 /* This isn't used anywhere.  */
-/* Nonzero means we can split a frame even if it is "unsplittable".  */
-static int inhibit_frame_unsplittable;
-#endif /* 0 */
-
 extern EMACS_INT scroll_margin;
 
 extern Lisp_Object Qwindow_scroll_functions, Vwindow_scroll_functions;
@@ -3638,7 +3638,9 @@
   /* Store the current buffer's actual point into the
      old selected window.  It belongs to that window,
      and when the window is not selected, must be in the window.  */
-  if (!NILP (selected_window))
+  if (inhibit_point_swap)
+    inhibit_point_swap = 0;
+  else
     {
       ow = XWINDOW (selected_window);
       if (! NILP (ow->buffer))
@@ -5861,7 +5863,7 @@
     /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer
        when passed below to set_marker_both.  */
     error ("move-to-window-line called from unrelated buffer");
-  
+
   window = selected_window;
   start = marker_position (w->start);
   if (start < BEGV || start > ZV)
@@ -6241,10 +6243,6 @@
        }
 
       FRAME_ROOT_WINDOW (f) = data->root_window;
-      /* Prevent "swapping out point" in the old selected window
-        using the buffer that has been restored into it.
-        We already swapped out point that from that window's old buffer.  */
-      selected_window = Qnil;
 
       /* Arrange *not* to restore point in the buffer that was
         current when the window configuration was saved.  */
@@ -6253,6 +6251,11 @@
                               make_number (old_point),
                               XWINDOW (data->current_window)->buffer);
 
+      /* In the following call to `select-window, prevent "swapping
+        out point" in the old selected window using the buffer that
+        has been restored into it.  We already swapped out that point
+        from that window's old buffer.  */
+      inhibit_point_swap = 1;
       Fselect_window (data->current_window, Qnil);
       XBUFFER (XWINDOW (selected_window)->buffer)->last_selected_window
        = selected_window;
@@ -6262,13 +6265,6 @@
              && FRAME_LIVE_P (XFRAME (data->focus_frame))))
        Fredirect_frame_focus (frame, data->focus_frame);
 
-#if 0 /* I don't understand why this is needed, and it causes problems
-         when the frame's old selected window has been deleted.  */
-      if (f != selected_frame && FRAME_WINDOW_P (f))
-       do_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)),
-                        0, 0, Qnil);
-#endif
-
       /* Set the screen height to the value it had before this function.  */
       if (previous_frame_lines != FRAME_LINES (f)
          || previous_frame_cols != FRAME_COLS (f))
@@ -7218,6 +7214,8 @@
   window_scroll_preserve_hpos = -1;
   window_scroll_preserve_vpos = -1;
 
+  inhibit_point_swap = 0;
+
   DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function,
               doc: /* Non-nil means call as function to display a help buffer.
 The function is called with one argument, the buffer to be displayed.


reply via email to

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