To: "Andrew W. Freeman" <[email protected]>
In-Reply-To: <008701bec739$28f28bc0$3d7667cf@cronos>
Cc: "Vimdev" <[email protected]>
Subject: Patch 5.4n.7 (was: vim54n [crash using Ron's FuncPrototypes.vim])
Fcc: outbox
From: Bram Moolenaar <[email protected]>
------------

Andrew W Freeman wrote:

> I have found that this only crashes when I try and use Ron's function on a
> line greater than 1.
>
> Ron's function works as expected if I press the F1 key with only one '('
> after the function name.  However, if I insert both '(' and ')' then press
> the F1 key I get a structure versus a function displayed.  The second F1
> causes it to crash no matter what I file I am using.

OK, I can reproduce it now.  With Rob's script, of course.

The problem is that a wrong pointer was used.  It is surprising that this
didn't cause problems before.  The fix is simple though.


Patch 5.4n.7
Problem:    Closing a window is a specific situation crashed Vim.  There was a
           mixup of the current buffer and the buffer of the closed window in
           ml_flush_line().
Solution:   Use "buf" instead of "curbuf" in the call to ml_updatechunk().
Files:      src/memline.c


*** ../vim-5.4n/src/memline.c   Sun Jul  4 20:36:01 1999
--- src/memline.c       Tue Jul  6 13:32:55 1999
***************
*** 2807,2813 ****
               buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
 #ifdef BYTE_OFFSET
               /* The else case is already covered by the insert and delete */
!               ml_updatechunk(curbuf, lnum, extra, ML_CHNK_UPDLINE);
 #endif
           }
           else
--- 2807,2813 ----
               buf->b_ml.ml_flags |= (ML_LOCKED_DIRTY | ML_LOCKED_POS);
 #ifdef BYTE_OFFSET
               /* The else case is already covered by the insert and delete */
!               ml_updatechunk(buf, lnum, extra, ML_CHNK_UPDLINE);
 #endif
           }
           else

--
ROBIN:  (warily) And if you get a question wrong?
ARTHUR: You are cast into the Gorge of Eternal Peril.
ROBIN:  Oh ... wacho!
                "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

--/-/---- Bram Moolenaar ---- [email protected] ---- [email protected] ---\-\--
 \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /