Mercurial > vim
comparison src/evalfunc.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 | d03a52e02f1a |
children | cee12488e4bc |
comparison
equal
deleted
inserted
replaced
17158:7aee4ff9e8a5 | 17159:3fd0765f454f |
---|---|
446 static void f_test_getvalue(typval_T *argvars, typval_T *rettv); | 446 static void f_test_getvalue(typval_T *argvars, typval_T *rettv); |
447 static void f_test_option_not_set(typval_T *argvars, typval_T *rettv); | 447 static void f_test_option_not_set(typval_T *argvars, typval_T *rettv); |
448 static void f_test_override(typval_T *argvars, typval_T *rettv); | 448 static void f_test_override(typval_T *argvars, typval_T *rettv); |
449 static void f_test_refcount(typval_T *argvars, typval_T *rettv); | 449 static void f_test_refcount(typval_T *argvars, typval_T *rettv); |
450 static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv); | 450 static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv); |
451 static void f_test_garbagecollect_soon(typval_T *argvars, typval_T *rettv); | |
451 static void f_test_ignore_error(typval_T *argvars, typval_T *rettv); | 452 static void f_test_ignore_error(typval_T *argvars, typval_T *rettv); |
452 static void f_test_null_blob(typval_T *argvars, typval_T *rettv); | 453 static void f_test_null_blob(typval_T *argvars, typval_T *rettv); |
453 #ifdef FEAT_JOB_CHANNEL | 454 #ifdef FEAT_JOB_CHANNEL |
454 static void f_test_null_channel(typval_T *argvars, typval_T *rettv); | 455 static void f_test_null_channel(typval_T *argvars, typval_T *rettv); |
455 #endif | 456 #endif |
1017 #endif | 1018 #endif |
1018 {"test_alloc_fail", 3, 3, f_test_alloc_fail}, | 1019 {"test_alloc_fail", 3, 3, f_test_alloc_fail}, |
1019 {"test_autochdir", 0, 0, f_test_autochdir}, | 1020 {"test_autochdir", 0, 0, f_test_autochdir}, |
1020 {"test_feedinput", 1, 1, f_test_feedinput}, | 1021 {"test_feedinput", 1, 1, f_test_feedinput}, |
1021 {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now}, | 1022 {"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now}, |
1023 {"test_garbagecollect_soon", 0, 0, f_test_garbagecollect_soon}, | |
1022 {"test_getvalue", 1, 1, f_test_getvalue}, | 1024 {"test_getvalue", 1, 1, f_test_getvalue}, |
1023 {"test_ignore_error", 1, 1, f_test_ignore_error}, | 1025 {"test_ignore_error", 1, 1, f_test_ignore_error}, |
1024 {"test_null_blob", 0, 0, f_test_null_blob}, | 1026 {"test_null_blob", 0, 0, f_test_null_blob}, |
1025 #ifdef FEAT_JOB_CHANNEL | 1027 #ifdef FEAT_JOB_CHANNEL |
1026 {"test_null_channel", 0, 0, f_test_null_channel}, | 1028 {"test_null_channel", 0, 0, f_test_null_channel}, |
14458 } | 14460 } |
14459 else if (STRCMP(name, (char_u *)"nfa_fail") == 0) | 14461 else if (STRCMP(name, (char_u *)"nfa_fail") == 0) |
14460 nfa_fail_for_testing = val; | 14462 nfa_fail_for_testing = val; |
14461 else if (STRCMP(name, (char_u *)"no_query_mouse") == 0) | 14463 else if (STRCMP(name, (char_u *)"no_query_mouse") == 0) |
14462 no_query_mouse_for_testing = val; | 14464 no_query_mouse_for_testing = val; |
14465 else if (STRCMP(name, (char_u *)"no_wait_return") == 0) | |
14466 no_wait_return = val; | |
14463 else if (STRCMP(name, (char_u *)"ALL") == 0) | 14467 else if (STRCMP(name, (char_u *)"ALL") == 0) |
14464 { | 14468 { |
14465 disable_char_avail_for_testing = FALSE; | 14469 disable_char_avail_for_testing = FALSE; |
14466 disable_redraw_for_testing = FALSE; | 14470 disable_redraw_for_testing = FALSE; |
14467 ignore_redraw_flag_for_testing = FALSE; | 14471 ignore_redraw_flag_for_testing = FALSE; |
14546 f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) | 14550 f_test_garbagecollect_now(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
14547 { | 14551 { |
14548 /* This is dangerous, any Lists and Dicts used internally may be freed | 14552 /* This is dangerous, any Lists and Dicts used internally may be freed |
14549 * while still in use. */ | 14553 * while still in use. */ |
14550 garbage_collect(TRUE); | 14554 garbage_collect(TRUE); |
14555 } | |
14556 | |
14557 /* | |
14558 * "test_garbagecollect_soon()" function | |
14559 */ | |
14560 static void | |
14561 f_test_garbagecollect_soon(typval_T *argvars UNUSED, typval_T *rettv UNUSED) | |
14562 { | |
14563 may_garbage_collect = TRUE; | |
14551 } | 14564 } |
14552 | 14565 |
14553 /* | 14566 /* |
14554 * "test_ignore_error()" function | 14567 * "test_ignore_error()" function |
14555 */ | 14568 */ |