vim-patch:8.1.0868: crash if triggering garbage collector after a function call

Problem:    Crash if triggering garbage collector after a function call.
            (Michael Henry)
Solution:   Don't call the garbage collector right away, do it later.
            (closes vim/vim#3894)
889da2f243
This commit is contained in:
Jan Edmund Lazo 2020-04-29 00:35:44 -04:00
parent 66369cd9d0
commit a89d64b687
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -613,10 +613,10 @@ static void cleanup_function_call(funccall_T *fc)
if (++made_copy == 10000) { if (++made_copy == 10000) {
// We have made a lot of copies. This can happen when // We have made a lot of copies. This can happen when
// repetitively calling a function that creates a reference to // repetitively calling a function that creates a reference to
// itself somehow. Call the garbage collector here to avoid using // itself somehow. Call the garbage collector soon to avoid using
// too much memory. // too much memory.
made_copy = 0; made_copy = 0;
(void)garbage_collect(false); want_garbage_collect = true;
} }
} }
} }