fix(decoration): fix crash when on_lines decor provider modifies marktree

If a "on_lines" callback changes the structure of the marktree, the
iterator (which is used for an entire window viewport) might now
point to invalid memory. Restore the iterator to the beginning of the
line in this case.

fixes #29484
This commit is contained in:
bfredl
2025-01-03 12:36:36 +01:00
parent fa298fd2f4
commit 33ff546b50
6 changed files with 55 additions and 7 deletions

View File

@@ -1051,12 +1051,12 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
}
}
has_decor = decor_redraw_line(wp, lnum - 1, &decor_state);
if (!end_fill) {
decor_providers_invoke_line(wp, lnum - 1, &has_decor);
decor_providers_invoke_line(wp, lnum - 1);
}
has_decor = decor_redraw_line(wp, lnum - 1, &decor_state);
if (has_decor) {
extra_check = true;
}