patch 8.2.3788: lambda for option that is a function may be freed
Problem: Lambda for option that is a function may be garbage collected.
Solution: Set a reference in the funcref. (Yegappan Lakshmanan,
closes #9330)
This commit is contained in:
committed by
Bram Moolenaar
parent
6e371ecb27
commit
6ae8fae869
24
src/tag.c
24
src/tag.c
@ -133,15 +133,31 @@ set_tagfunc_option(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
# if defined(EXITFREE) || defined(PROTO)
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
void
|
||||
free_tagfunc_option(void)
|
||||
{
|
||||
# ifdef FEAT_EVAL
|
||||
# ifdef FEAT_EVAL
|
||||
free_callback(&tfu_cb);
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mark the global 'tagfunc' callback with 'copyID' so that it is not garbage
|
||||
* collected.
|
||||
*/
|
||||
int
|
||||
set_ref_in_tagfunc(int copyID UNUSED)
|
||||
{
|
||||
int abort = FALSE;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
abort = set_ref_in_callback(&tfu_cb, copyID);
|
||||
#endif
|
||||
|
||||
return abort;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the global 'tagfunc' callback function to the buffer-local 'tagfunc'
|
||||
|
||||
Reference in New Issue
Block a user