From b6a9e8b1a2ed4dbf77aa51d3817c9f47c1cb16b4 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Sat, 3 Nov 2012 09:11:34 +0400 Subject: [PATCH] * 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 . (Fwindow_body_width, Fwindow_body_height): Simplify a bit. * font.c (Ffont_at): Likewise. --- src/ChangeLog | 9 +++++++++ src/font.c | 5 +---- src/window.c | 7 +++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 26d4b7f534..512982858d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-11-03 Dmitry Antipov + + * 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 . + (Fwindow_body_width, Fwindow_body_height): Simplify a bit. + * font.c (Ffont_at): Likewise. + 2012-11-01 Jan Djärv * widget.c (resize_cb): New function. diff --git a/src/font.c b/src/font.c index 87932b0e44..e960f9b3d1 100644 --- a/src/font.c +++ b/src/font.c @@ -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 diff --git a/src/window.c b/src/window.c index 8dbecf9c81..766765cfa0 100644 --- a/src/window.c +++ b/src/window.c @@ -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)) -- 2.20.1