diff src/window.c @ 10883:cb71a5468aca v8.0.0331

patch 8.0.0331: restoring help snapshot accesses freed memory commit https://github.com/vim/vim/commit/343b8c042967da82f2f022afa31f2c97a264c1c8 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 17 12:04:56 2017 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Fri, 17 Feb 2017 12:15:05 +0100
parents c9da7f9137af
children 506f5d8b7d8b
line wrap: on
line diff
--- a/src/window.c
+++ b/src/window.c
@@ -6551,7 +6551,7 @@ restore_snapshot(
 
 /*
  * 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 @@ check_snapshot_rec(frame_T *sn, frame_T 
 	    || (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;
 }