comparison src/popupwin.c @ 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 8a095d343c59
children b60402471f69
comparison
equal deleted inserted replaced
17299:7a542332835b 17300:0dff534a0807
1435 { 1435 {
1436 typval_T res; 1436 typval_T res;
1437 1437
1438 res.v_type = VAR_NUMBER; 1438 res.v_type = VAR_NUMBER;
1439 res.vval.v_number = -2; 1439 res.vval.v_number = -2;
1440 // Careful: this makes "wp" invalid.
1440 popup_close_and_callback(wp, &res); 1441 popup_close_and_callback(wp, &res);
1441 } 1442 }
1442 } 1443 }
1443 1444
1444 /* 1445 /*
1445 * Called when the mouse moved: may close a popup with "mousemoved". 1446 * Called when the mouse moved: may close a popup with "mousemoved".
1446 */ 1447 */
1447 void 1448 void
1448 popup_handle_mouse_moved(void) 1449 popup_handle_mouse_moved(void)
1449 { 1450 {
1450 win_T *wp; 1451 win_T *wp, *nextwp;
1451 win_T *mouse_wp; 1452 win_T *mouse_wp;
1452 int row = mouse_row; 1453 int row = mouse_row;
1453 int col = mouse_col; 1454 int col = mouse_col;
1454 1455
1455 // find the window where the mouse is in 1456 // find the window where the mouse is in
1456 mouse_wp = mouse_find_win(&row, &col, FIND_POPUP); 1457 mouse_wp = mouse_find_win(&row, &col, FIND_POPUP);
1457 1458
1458 for (wp = first_popupwin; wp != NULL; wp = wp->w_next) 1459 for (wp = first_popupwin; wp != NULL; wp = nextwp)
1460 {
1461 nextwp = wp->w_next;
1459 check_mouse_moved(wp, mouse_wp); 1462 check_mouse_moved(wp, mouse_wp);
1460 for (wp = curtab->tp_first_popupwin; wp != NULL; wp = wp->w_next) 1463 }
1464 for (wp = curtab->tp_first_popupwin; wp != NULL; wp = nextwp)
1465 {
1466 nextwp = wp->w_next;
1461 check_mouse_moved(wp, mouse_wp); 1467 check_mouse_moved(wp, mouse_wp);
1468 }
1462 } 1469 }
1463 1470
1464 /* 1471 /*
1465 * In a filter: check if the typed key is a mouse event that is used for 1472 * In a filter: check if the typed key is a mouse event that is used for
1466 * dragging the popup. 1473 * dragging the popup.