Mercurial > vim
comparison src/eval.c @ 27591:d91be28bbdbb v8.2.4322
patch 8.2.4322: Vim9: crash when using funcref with closure
Commit: https://github.com/vim/vim/commit/7aca5ca6763e50d2c23953b20e30fca7457c9abf
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 7 19:56:43 2022 +0000
patch 8.2.4322: Vim9: crash when using funcref with closure
Problem: Vim9: crash when using funcref with closure.
Solution: Keep a reference to the funcref that has the outer context.
(closes #9716)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 07 Feb 2022 21:00:02 +0100 |
parents | d4921b91542c |
children | 42d0279c6e7c |
comparison
equal
deleted
inserted
replaced
27590:cc44ec730954 | 27591:d91be28bbdbb |
---|---|
4524 func_ptr_unref(pt->pt_func); | 4524 func_ptr_unref(pt->pt_func); |
4525 | 4525 |
4526 // "out_up" is no longer used, decrement refcount on partial that owns it. | 4526 // "out_up" is no longer used, decrement refcount on partial that owns it. |
4527 partial_unref(pt->pt_outer.out_up_partial); | 4527 partial_unref(pt->pt_outer.out_up_partial); |
4528 | 4528 |
4529 // Using pt_outer from another partial. | |
4530 partial_unref(pt->pt_outer_partial); | |
4531 | |
4529 // Decrease the reference count for the context of a closure. If down | 4532 // Decrease the reference count for the context of a closure. If down |
4530 // to the minimum it may be time to free it. | 4533 // to the minimum it may be time to free it. |
4531 if (pt->pt_funcstack != NULL) | 4534 if (pt->pt_funcstack != NULL) |
4532 { | 4535 { |
4533 --pt->pt_funcstack->fs_refcount; | 4536 --pt->pt_funcstack->fs_refcount; |