Patch 8.1.1711

20 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 17, 2019, 4:56:02 PM7/17/19
to vim...@googlegroups.com

Patch 8.1.1711
Problem: Listener callback called at the wrong moment
Solution: Invoke listeners before calling ml_delete_int(). (closes #4657)
Files: src/memline.c


*** ../vim-8.1.1710/src/memline.c 2019-07-15 23:02:10.039954907 +0200
--- src/memline.c 2019-07-17 22:53:59.739478625 +0200
***************
*** 3566,3571 ****
--- 3566,3580 ----
ml_delete(linenr_T lnum, int message)
{
ml_flush_line(curbuf);
+ if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
+ return FAIL;
+
+ #ifdef FEAT_EVAL
+ // When inserting above recorded changes: flush the changes before changing
+ // the text.
+ may_invoke_listeners(curbuf, lnum, lnum + 1, -1);
+ #endif
+
return ml_delete_int(curbuf, lnum, message);
}

***************
*** 3590,3603 ****
int textprop_save_len;
#endif

- if (lnum < 1 || lnum > buf->b_ml.ml_line_count)
- return FAIL;
-
- #ifdef FEAT_EVAL
- // When inserting above recorded changes: flush the changes before changing
- // the text.
- may_invoke_listeners(buf, lnum, lnum + 1, -1);
- #endif
if (lowest_marked && lowest_marked > lnum)
lowest_marked--;

--- 3599,3604 ----
*** ../vim-8.1.1710/src/version.c 2019-07-17 22:00:15.591219445 +0200
--- src/version.c 2019-07-17 22:55:17.355101243 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1711,
/**/

--
Kisses may last for as much as, but no more than, five minutes.
[real standing law in Iowa, United States of America]

/// Bram Moolenaar -- Br...@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 ///

Paul Jolly

unread,
Jul 18, 2019, 4:51:15 AM7/18/19
to Vim Dev Mailing List
Thanks very much for taking the time to investigate, debug and fix this.
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/201907172055.x6HKtsMg002351%40masaka.moolenaar.net.
> For more options, visit https://groups.google.com/d/optout.

Bram Moolenaar

unread,
Jul 18, 2019, 6:06:58 AM7/18/19
to vim...@googlegroups.com, Paul Jolly

Paul Jolly wrote:

> Thanks very much for taking the time to investigate, debug and fix this.

Thanks for making the repro steps. It turns out the exact text content
mattered and the exact change mattered. After failing to spot it by
stepping through the code, I added ch_log() calls in various places to
see what happens, and finally spotted the getbufline() call happening
while in a lower level memline function, where it should not invoke the
callback. Moving that to a higher level fortunately wasn't difficult.

--
It is illegal to rob a bank and then shoot at the bank teller with a water
pistol.
[real standing law in Louisana, United States of America]
Reply all
Reply to author
Forward
0 new messages