patch 8.1.0425: ml_get error and crash with appendbufline()
Problem: ml_get error and crash with appendbufline(). (Masashi Iizuka)
Solution: Set per-window buffer info. (Hirohito Higashi, closes #3455)
diff --git a/src/buffer.c b/src/buffer.c
index b536be6..a4afe13 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -428,7 +428,10 @@
FOR_ALL_WINDOWS(wp)
if (wp->w_buffer == buf)
+ {
can_unload = FALSE;
+ break;
+ }
}
if (!can_unload)
EMSG(_("E937: Attempt to delete a buffer that is in use"));
@@ -1742,6 +1745,9 @@
/* mark cursor position as being invalid */
curwin->w_valid = 0;
+ buflist_setfpos(curbuf, curwin, curbuf->b_last_cursor.lnum,
+ curbuf->b_last_cursor.col, TRUE);
+
/* Make sure the buffer is loaded. */
if (curbuf->b_ml.ml_mfp == NULL) /* need to load the file */
{