diff src/dict.c @ 17159:3fd0765f454f v8.1.1579

patch 8.1.1579: dict and list could be GC'ed while displaying error commit https://github.com/vim/vim/commit/adc6714aac20f5462a0ecec50ab4806b2f3ab0db Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 22 01:40:42 2019 +0200 patch 8.1.1579: dict and list could be GC'ed while displaying error Problem: Dict and list could be GC'ed while displaying error in a timer. (Yasuhiro Matsumoto) Solution: Block garbage collection when executing a timer. Add test_garbagecollect_soon(). Add "no_wait_return" to test_override(). (closes #4571)
author Bram Moolenaar <Bram@vim.org>
date Sat, 22 Jun 2019 01:45:05 +0200
parents efc6f5e3b543
children 6604ecb7a615
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -28,7 +28,7 @@ dict_alloc(void)
 {
     dict_T *d;
 
-    d = ALLOC_ONE(dict_T);
+    d = ALLOC_CLEAR_ONE(dict_T);
     if (d != NULL)
     {
 	/* Add the dict to the list of dicts for garbage collection. */
@@ -811,7 +811,7 @@ dict_get_tv(char_u **arg, typval_T *rett
     {
 	semsg(_("E723: Missing end of Dictionary '}': %s"), *arg);
 failret:
-	if (evaluate)
+	if (d != NULL)
 	    dict_free(d);
 	return FAIL;
     }