patch 8.0.0331: restoring help snapshot accesses freed memory
Problem: Restoring help snapshot accesses freed memory. (Dominique Pelle)
Solution: Don't restore a snapshot when the window closes.
diff --git a/src/window.c b/src/window.c
index 6b7bd35..c9771af 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6551,7 +6551,7 @@
/*
* Check if frames "sn" and "fr" have the same layout, same following frames
- * and same children.
+ * and same children. And the window pointer is valid.
*/
static int
check_snapshot_rec(frame_T *sn, frame_T *fr)
@@ -6562,7 +6562,8 @@
|| (sn->fr_next != NULL
&& check_snapshot_rec(sn->fr_next, fr->fr_next) == FAIL)
|| (sn->fr_child != NULL
- && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL))
+ && check_snapshot_rec(sn->fr_child, fr->fr_child) == FAIL)
+ || !win_valid(sn->fr_win))
return FAIL;
return OK;
}