Bug#400771: vim-gtk loops in syntax_start()
Carlo Wood
carlo at alinoe.com
Tue Nov 28 16:27:15 UTC 2006
Package: vim-gtk
Version: 7.0-122+1
vim uses 100% cpu while scrolling up (starting in a given state)
the attached file.
How to reproduce:
Open a gnome-terminal with a height of 24 lines and a width of
126 characters (maximized horizontally on a 1024x768 screen using
courier 11 font (default)).
In this gnome-terminal run:
$ /usr/bin/vim.gtk Makefile.am
Go to the top of the file if not already there.
Press and hold 'j', scrolling down until you hit the bottom.
Then press and hold 'k', scrolling up until vim freezes and
starts to use 100% cpu. If it doesn't freeze the first time,
try doing it again (go always completely to the bottom and
completely to the top - use scrolling, not 'G' to jump).
Once looping, it loops inside syntax_start where current_lnum
loops over the values 27 to 31, jumping back to 27 after
having had value 31 in the last line of load_current_state.
At that moment we have the following backtrace:
#0 load_current_state (from=0x827a154) at syntax.c:1504
#1 0x0817167f in syntax_start (wp=0x81e5a38, lnum=37) at syntax.c:593
#2 0x08142c85 in win_update (wp=0x81e5a38) at screen.c:2694
#3 0x0814565f in update_screen (type=0) at screen.c:535
#4 0x080d2bb5 in main_loop (cmdwin=0, noexmode=0) at main.c:1083
#5 0x080d5c86 in main (argc=Cannot access memory at address 0x3) at main.c:934
It never leaves syntax_start(), in fact, it never leaves the
while loop in this function:
559 while (current_lnum < lnum)
560 {
561 syn_start_line();
562 (void)syn_finish_line(FALSE);
563 ++current_lnum;
564
565 /* If we parsed at least "minlines" lines or started at a valid
566 * state, the current state is considered valid. */
567 if (current_lnum >= first_stored)
568 {
569 /* Check if the saved state entry is for the current line and is
570 * equal to the current state. If so, then validate all saved
571 * states that depended on a change before the parsed line. */
572 if (prev == NULL)
573 sp = syn_buf->b_sst_first;
574 else
575 sp = prev->sst_next;
576 if (sp != NULL
577 && sp->sst_lnum == current_lnum
578 && syn_stack_equal(sp))
579 {
580 parsed_lnum = current_lnum;
581 prev = sp;
582 while (sp != NULL && sp->sst_change_lnum <= parsed_lnum)
583 {
584 if (sp->sst_lnum <= lnum)
585 /* valid state before desired line, use this one */
586 prev = sp;
587 else if (sp->sst_change_lnum == 0)
588 /* past saved states depending on change, break here. */
589 break;
590 sp->sst_change_lnum = 0;
591 sp = sp->sst_next;
592 }
593 load_current_state(prev);
594 }
595 /* Store the state at this line when it's the first one, the line
596 * where we start parsing, or some distance from the previously
597 * saved state. But only when parsed at least 'minlines'. */
598 else if (prev == NULL
599 || current_lnum == lnum
600 || current_lnum >= prev->sst_lnum + dist)
601 prev = store_current_state(prev);
602 }
Attached: 'Makefile.am.gz', please gunzip before opening ;).
Output of ":filetype"
filetype detection:ON plugin:ON indent:OFF
Output of ":set filetype"
filetype=automake
--
Carlo Wood <carlo at alinoe.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile.am.gz
Type: application/octet-stream
Size: 1008 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20061128/c8dfb58f/Makefile.am.obj
More information about the pkg-vim-maintainers
mailing list