To: vim_dev@googlegroups.com Subject: Patch 8.1.1675 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1675 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. Files: src/change.c *** ../vim-8.1.1674/src/change.c 2019-06-08 18:07:17.744161734 +0200 --- src/change.c 2019-07-13 12:56:08.925257292 +0200 *************** *** 325,339 **** * listener_remove() function */ void ! f_listener_remove(typval_T *argvars, typval_T *rettv UNUSED) { listener_T *lnr; listener_T *next; ! listener_T *prev = NULL; int id = tv_get_number(argvars); buf_T *buf; for (buf = firstbuf; buf != NULL; buf = buf->b_next) for (lnr = buf->b_listener; lnr != NULL; lnr = next) { next = lnr->lr_next; --- 325,341 ---- * listener_remove() function */ void ! f_listener_remove(typval_T *argvars, typval_T *rettv) { listener_T *lnr; listener_T *next; ! listener_T *prev; int id = tv_get_number(argvars); buf_T *buf; for (buf = firstbuf; buf != NULL; buf = buf->b_next) + { + prev = NULL; for (lnr = buf->b_listener; lnr != NULL; lnr = next) { next = lnr->lr_next; *************** *** 345,353 **** --- 347,358 ---- buf->b_listener = lnr->lr_next; free_callback(&lnr->lr_callback); vim_free(lnr); + rettv->vval.v_number = 1; + return; } prev = lnr; } + } } /* *** ../vim-8.1.1674/src/version.c 2019-07-12 22:46:26.423091651 +0200 --- src/version.c 2019-07-13 12:57:08.033026455 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1675, /**/ -- ARTHUR: Listen, old crone! Unless you tell us where we can buy a shrubbery, my friend and I will ... we will say "Ni!" CRONE: Do your worst! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///