bug-gnu-emacs
[Top][All Lists]
Advanced

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

infinite loop in scroll-up


From: Sergey Vlasov
Subject: infinite loop in scroll-up
Date: Fri, 21 Mar 2003 19:48:57 +0300

In GNU Emacs 21.3.1 (i686-pc-linux-gnu, X toolkit)
 of 2003-03-20 on center4.mivlgu.local
configured using `configure  --prefix=/home/vsu/opt/emacs --with-x 
--without-toolkit-scroll-bars'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: ru_RU.KOI8-R
  value of $LC_CTYPE: ru_RU.KOI8-R
  value of $LC_MESSAGES: ru_RU.KOI8-R
  value of $LC_MONETARY: ru_RU.KOI8-R
  value of $LC_NUMERIC: ru_RU.KOI8-R
  value of $LC_TIME: ru_RU.KOI8-R
  value of $LANG: ru_RU.KOI8-R
  locale-coding-system: cyrillic-koi8
  default-enable-multibyte-characters: t

I have tried to use the following configuration in my ~/.emacs:

(setq scroll-conservatively 1000)
(setq scroll-margin 1)
(temp-buffer-resize-mode 1)
(mwheel-install)

In some cases when I try to use the mouse wheel Emacs gets stuck
eating all CPU; C-g does not work; killing the Emacs process with
SIGFPE breaks the loop.

I have reduced the problem to the following test case (freshly started
'emacs -q --no-site-file', no X resources):

M-x set-variable RET scroll-conservatively RET 1000 RET
M-x set-variable RET scroll-margin RET 1 RET
M-x temp-buffer-resize-mode RET
C-h f mwheel-install RET
     (this produces a buffer with 4 lines of text, last line does not
     end with '\n)
C-x o
     (switches to the *Help* buffer)
M-: (scroll-up 3) RET
     (the number is 1 less than the buffer height)

At this point Emacs does not respond even to C-g.  Examination using
gdb reveals that it is stuck in the loop in
src/window.c:window_scroll_pixel_based():

0x0807c935 in window_scroll_pixel_based (window=13, n=3, whole=0, noerror=0)
    at window.c:4127
4127                move_it_by_lines (&it, 1, 1);
(gdb) l
4122            {
4123              /* We moved the window start towards ZV, so PT may be now
4124                 in the scroll margin at the top.  */
4125              move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4126              while (it.current_y < this_scroll_margin)
4127                move_it_by_lines (&it, 1, 1);
4128              SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4129            }
4130          else if (n < 0)
4131            {

(More detailed gdb output is at the end of message.)

The same behavior can be reproduced by adding one character at the end
of the initial *scratch* buffer (there will be 5 lines of text (one of
them empty), the last line not ending with '\n'), splitting the window
(C-x 2) and resizing the window to 5 lines (so that the whole text
will just fit), then doing (scroll-up 4).  In fact, splitting is not
absolutely necessary - the same infinite loop happens when the frame
is resized vertically so that the text will just fit.


Recent input:
M-x s e t - v a r <return> s c r o l l - c o n s <return> 
1 0 0 0 <return> M-x s e t - v a r <return> s c r o 
l l - m a r <return> 1 <return> M-x t e m p - b <return> 
C-h f m w h e e l - i n <tab> <return> C-x o M-: ( 
s c r o l l - u p SPC 3 ) <return> M-x r e p o r t 
<tab> <return>

Recent messages:
Loading tooltip...done
For information about the GNU Project and its goals, type C-h C-p.
Temp-Buffer-Resize mode enabled
Loading view...done
Type C-x 1 to remove help window.  C-M-v to scroll the help.
eval: 
Loading debug...done
Entering debugger...
 [2 times]
Loading emacsbug...done


==================== begin gdb output ====================
0x0807c935 in window_scroll_pixel_based (window=13, n=3, whole=0, noerror=0)
    at window.c:4127
4127                move_it_by_lines (&it, 1, 1);
(gdb) l
4122            {
4123              /* We moved the window start towards ZV, so PT may be now
4124                 in the scroll margin at the top.  */
4125              move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
4126              while (it.current_y < this_scroll_margin)
4127                move_it_by_lines (&it, 1, 1);
4128              SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
4129            }
4130          else if (n < 0)
4131            {
(gdb) info locals
it = {
  window = 1213260232, 
  w = 0x850e1c8, 
  f = 0x8495428, 
  method = 0x8061ea0 <next_element_from_buffer>, 
  stop_charpos = 150, 
  end_charpos = 150, 
  s = 0x0, 
  string_nchars = 0, 
  region_beg_charpos = -1, 
  region_end_charpos = -1, 
  redisplay_end_trigger_charpos = 0, 
  multibyte_p = 1, 
  header_line_p = 0, 
  string_from_display_prop_p = 0, 
  dp = 0x8492e80, 
  dpvec = 0x0, 
  dpend = 0x0, 
  dpvec_char_len = 0, 
  saved_face_id = 0, 
  ctl_chars = {0 <repeats 16 times>}, 
  current = {
    pos = {
      charpos = 150, 
      bytepos = 150
    }, 
    overlay_string_index = -1, 
    string_pos = {
      charpos = -1, 
      bytepos = -1
    }, 
    dpvec_index = -1
  }, 
  overlay_strings = {0, 0, 0}, 
  n_overlay_strings = 0, 
  string = 405269724, 
  stack = {{
      stop_charpos = 0, 
      face_id = 0, 
---Type <return> to continue, or q <return> to quit---
      string = 0, 
      pos = {
        pos = {
          charpos = 0, 
          bytepos = 0
        }, 
        overlay_string_index = 0, 
        string_pos = {
          charpos = 0, 
          bytepos = 0
        }, 
        dpvec_index = 0
      }, 
      end_charpos = 0, 
      string_nchars = 0, 
      area = LEFT_MARGIN_AREA, 
      multibyte_p = 0, 
      string_from_display_prop_p = 0, 
      display_ellipsis_p = 0, 
      space_width = 0, 
      voffset = 0, 
      font_height = 0
    }, {
      stop_charpos = 0, 
      face_id = 0, 
      string = 0, 
      pos = {
        pos = {
          charpos = 0, 
          bytepos = 0
        }, 
        overlay_string_index = 0, 
        string_pos = {
          charpos = 0, 
          bytepos = 0
        }, 
        dpvec_index = 0
      }, 
      end_charpos = 0, 
---Type <return> to continue, or q <return> to quit---
      string_nchars = 0, 
      area = LEFT_MARGIN_AREA, 
      multibyte_p = 0, 
      string_from_display_prop_p = 0, 
      display_ellipsis_p = 0, 
      space_width = 0, 
      voffset = 0, 
      font_height = 0
    }}, 
  sp = 0, 
  selective_display_ellipsis_p = 1, 
  ctl_arrow_p = 1, 
  selective = 0, 
  what = IT_EOB, 
  face_id = 0, 
  face_box_p = 0, 
  start_of_box_run_p = 0, 
  end_of_box_run_p = 0, 
  overlay_strings_at_end_processed_p = 1, 
  glyph_not_available_p = 0, 
  starts_in_middle_of_char_p = 0, 
  face_before_selective_p = 0, 
  base_face_id = 0, 
  c = 46, 
  len = 1, 
  cmp_id = 0, 
  cmp_len = 0, 
  char_to_display = 46, 
  image_id = 0, 
  space_width = 405269724, 
  voffset = 0, 
  font_height = 405269724, 
  object = 1211261376, 
  position = {
    charpos = 150, 
    bytepos = 150
  }, 
  truncate_lines_p = 0, 
  tab_width = 8, 
---Type <return> to continue, or q <return> to quit---
  truncation_pixel_width = 0, 
  continuation_pixel_width = 0, 
  first_visible_x = 0, 
  last_visible_x = 560, 
  last_visible_y = 52, 
  extra_line_spacing = 0, 
  glyph_row = 0x85ba0f8, 
  area = TEXT_AREA, 
  nglyphs = 1, 
  pixel_width = 7, 
  ascent = 10, 
  descent = 3, 
  max_ascent = 10, 
  max_descent = 3, 
  phys_ascent = 1, 
  phys_descent = 0, 
  max_phys_ascent = 10, 
  max_phys_descent = 3, 
  current_x = 189, 
  continuation_lines_width = 0, 
  current_y = 0, 
  vpos = 0, 
  hpos = 27
}
w = (struct window *) 0x850e1c8
start = {
  charpos = 674853048, 
  bytepos = 1
}
tem = 1
this_scroll_margin = 13
preserve_y = 13
vscrolled = 0
==================== end gdb output ====================

-- 
Sergey Vlasov




reply via email to

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