mirror of
https://github.com/vim/vim.git
synced 2025-09-02 21:13:50 -04:00
patch 8.2.3753: Vim9: function unreferenced while called is never deleted
Problem: Vim9: function unreferenced while called is never deleted. Solution: Delete a function when no longer referenced.
This commit is contained in:
parent
8603be338a
commit
2336c376d5
@ -12,6 +12,7 @@ ufunc_T *find_func_even_dead(char_u *name, int is_global, cctx_T *cctx);
|
|||||||
ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx);
|
ufunc_T *find_func(char_u *name, int is_global, cctx_T *cctx);
|
||||||
int func_is_global(ufunc_T *ufunc);
|
int func_is_global(ufunc_T *ufunc);
|
||||||
int func_name_refcount(char_u *name);
|
int func_name_refcount(char_u *name);
|
||||||
|
void func_clear_free(ufunc_T *fp, int force);
|
||||||
int copy_func(char_u *lambda, char_u *global, ectx_T *ectx);
|
int copy_func(char_u *lambda, char_u *global, ectx_T *ectx);
|
||||||
int funcdepth_increment(void);
|
int funcdepth_increment(void);
|
||||||
void funcdepth_decrement(void);
|
void funcdepth_decrement(void);
|
||||||
|
@ -2281,7 +2281,7 @@ func_free(ufunc_T *fp, int force)
|
|||||||
* Free all things that a function contains and free the function itself.
|
* Free all things that a function contains and free the function itself.
|
||||||
* When "force" is TRUE we are exiting.
|
* When "force" is TRUE we are exiting.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
func_clear_free(ufunc_T *fp, int force)
|
func_clear_free(ufunc_T *fp, int force)
|
||||||
{
|
{
|
||||||
func_clear(fp, force);
|
func_clear(fp, force);
|
||||||
|
@ -753,6 +753,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
3753,
|
||||||
/**/
|
/**/
|
||||||
3752,
|
3752,
|
||||||
/**/
|
/**/
|
||||||
|
@ -4988,8 +4988,9 @@ call_def_function(
|
|||||||
estack_pop();
|
estack_pop();
|
||||||
current_sctx = save_current_sctx;
|
current_sctx = save_current_sctx;
|
||||||
|
|
||||||
// TODO: when is it safe to delete the function if it is no longer used?
|
if (--ufunc->uf_calls <= 0 && ufunc->uf_refcount <= 0)
|
||||||
--ufunc->uf_calls;
|
// Function was unreferenced while being used, free it now.
|
||||||
|
func_clear_free(ufunc, FALSE);
|
||||||
|
|
||||||
if (*msg_list != NULL && saved_msg_list != NULL)
|
if (*msg_list != NULL && saved_msg_list != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user