forked from aniani/vim
patch 8.1.1675: listener list not correctly updated on listener_remove()
Problem: Listener list not correctly updated on listener_remove(). Solution: Only set "prev" when not removing a listener. Return one if the listener was found and removed.
This commit is contained in:
@@ -325,15 +325,17 @@ f_listener_flush(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
* listener_remove() function
|
* listener_remove() function
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED)
|
f_listener_remove(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
listener_T *lnr;
|
listener_T *lnr;
|
||||||
listener_T *next;
|
listener_T *next;
|
||||||
listener_T *prev = NULL;
|
listener_T *prev;
|
||||||
int id = tv_get_number(argvars);
|
int id = tv_get_number(argvars);
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
|
||||||
|
{
|
||||||
|
prev = NULL;
|
||||||
for (lnr = buf->b_listener; lnr != NULL; lnr = next)
|
for (lnr = buf->b_listener; lnr != NULL; lnr = next)
|
||||||
{
|
{
|
||||||
next = lnr->lr_next;
|
next = lnr->lr_next;
|
||||||
@@ -345,10 +347,13 @@ f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED)
|
|||||||
buf->b_listener = lnr->lr_next;
|
buf->b_listener = lnr->lr_next;
|
||||||
free_callback(&lnr->lr_callback);
|
free_callback(&lnr->lr_callback);
|
||||||
vim_free(lnr);
|
vim_free(lnr);
|
||||||
|
rettv->vval.v_number = 1;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
prev = lnr;
|
prev = lnr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called before inserting a line above "lnum"/"lnum3" or deleting line "lnum"
|
* Called before inserting a line above "lnum"/"lnum3" or deleting line "lnum"
|
||||||
|
@@ -777,6 +777,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 */
|
||||||
|
/**/
|
||||||
|
1675,
|
||||||
/**/
|
/**/
|
||||||
1674,
|
1674,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user