* window.c (decode_next_window_args): Update window arg after
authorDmitry Antipov <dmantipov@yandex.ru>
Sat, 3 Nov 2012 05:11:34 +0000 (09:11 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Sat, 3 Nov 2012 05:11:34 +0000 (09:11 +0400)
calling decode_live_window and so fix crash reported at
http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00035.html
by Juanma Barranquero <lekktu@gmail.com>.
(Fwindow_body_width, Fwindow_body_height): Simplify a bit.
* font.c (Ffont_at): Likewise.

src/ChangeLog
src/font.c
src/window.c

index 26d4b7f..5129828 100644 (file)
@@ -1,3 +1,12 @@
+2012-11-03  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * window.c (decode_next_window_args): Update window arg after
+       calling decode_live_window and so fix crash reported at
+       http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00035.html
+       by Juanma Barranquero <lekktu@gmail.com>.
+       (Fwindow_body_width, Fwindow_body_height): Simplify a bit.
+       * font.c (Ffont_at): Likewise.
+
 2012-11-01  Jan Djärv  <jan.h.d@swipnet.se>
 
        * widget.c (resize_cb): New function.
index 87932b0..e960f9b 100644 (file)
@@ -4766,7 +4766,6 @@ character at index specified by POSITION.  */)
   (Lisp_Object position, Lisp_Object window, Lisp_Object string)
 {
   struct window *w = decode_live_window (window);
-  ptrdiff_t pos;
 
   if (NILP (string))
     {
@@ -4775,7 +4774,6 @@ character at index specified by POSITION.  */)
       CHECK_NUMBER_COERCE_MARKER (position);
       if (! (BEGV <= XINT (position) && XINT (position) < ZV))
        args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
-      pos = XINT (position);
     }
   else
     {
@@ -4783,10 +4781,9 @@ character at index specified by POSITION.  */)
       CHECK_STRING (string);
       if (! (0 <= XINT (position) && XINT (position) < SCHARS (string)))
        args_out_of_range (string, position);
-      pos = XINT (position);
     }
 
-  return font_at (-1, pos, NULL, w, string);
+  return font_at (-1, XINT (position), NULL, w, string);
 }
 
 #if 0
index 8dbecf9..766765c 100644 (file)
@@ -774,8 +774,7 @@ area is only partially visible, that counts as a whole line; to
 exclude partially-visible lines, use `window-text-height'.  */)
   (Lisp_Object window)
 {
-  struct window *w = decode_live_window (window);
-  return make_number (window_body_lines (w));
+  return make_number (window_body_lines (decode_live_window (window)));
 }
 
 DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0,
@@ -787,8 +786,7 @@ marginal areas, or scroll bars.  On a graphical display, the width is
 expressed as an integer multiple of the default character width.  */)
   (Lisp_Object window)
 {
-  struct window *w = decode_live_window (window);
-  return make_number (window_body_cols (w));
+  return make_number (window_body_cols (decode_live_window (window)));
 }
 
 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
@@ -2254,6 +2252,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
 {
   struct window *w = decode_live_window (*window);
 
+  XSETWINDOW (*window, w);
   /* MINIBUF nil may or may not include minibuffers.  Decide if it
      does.  */
   if (NILP (*minibuf))