Mercurial > vim
changeset 17300:0dff534a0807 v8.1.1649
patch 8.1.1649: Illegal memory access when closing popup window
commit https://github.com/vim/vim/commit/3e35d05b1f99419be27ea5be70c7d0610202c163
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jul 7 20:43:34 2019 +0200
patch 8.1.1649: Illegal memory access when closing popup window
Problem: Illegal memory access when closing popup window.
Solution: Get w_next before closing the window.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 07 Jul 2019 20:45:05 +0200 |
parents | 7a542332835b |
children | 59392e352add |
files | src/popupwin.c src/version.c |
diffstat | 2 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/popupwin.c +++ b/src/popupwin.c @@ -1437,6 +1437,7 @@ check_mouse_moved(win_T *wp, win_T *mous res.v_type = VAR_NUMBER; res.vval.v_number = -2; + // Careful: this makes "wp" invalid. popup_close_and_callback(wp, &res); } } @@ -1447,7 +1448,7 @@ check_mouse_moved(win_T *wp, win_T *mous void popup_handle_mouse_moved(void) { - win_T *wp; + win_T *wp, *nextwp; win_T *mouse_wp; int row = mouse_row; int col = mouse_col; @@ -1455,10 +1456,16 @@ popup_handle_mouse_moved(void) // find the window where the mouse is in mouse_wp = mouse_find_win(&row, &col, FIND_POPUP); - for (wp = first_popupwin; wp != NULL; wp = wp->w_next) + for (wp = first_popupwin; wp != NULL; wp = nextwp) + { + nextwp = wp->w_next; check_mouse_moved(wp, mouse_wp); - for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next) + } + for (wp = curtab->tp_first_popupwin; wp != NULL; wp = nextwp) + { + nextwp = wp->w_next; check_mouse_moved(wp, mouse_wp); + } } /*