To: vim_dev@googlegroups.com Subject: Patch 8.2.0746 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0746 Problem: popup_clear() hangs when a popup can't be closed. Solution: Bail out when a popup can't be closed. Files: src/popupwin.c, src/proto/popupwin.pro *** ../vim-8.2.0745/src/popupwin.c 2020-04-06 22:12:57.141652839 +0200 --- src/popupwin.c 2020-05-13 00:59:04.084633443 +0200 *************** *** 2531,2538 **** /* * Close a popup window by Window-id. * Does not invoke the callback. */ ! void popup_close(int id) { win_T *wp; --- 2531,2539 ---- /* * Close a popup window by Window-id. * Does not invoke the callback. + * Return OK if the popup was closed, FAIL otherwise. */ ! int popup_close(int id) { win_T *wp; *************** *** 2546,2570 **** if (wp == curwin) { error_for_popup_window(); ! return; } if (prev == NULL) first_popupwin = wp->w_next; else prev->w_next = wp->w_next; popup_free(wp); ! return; } // go through tab-local popups FOR_ALL_TABPAGES(tp) ! popup_close_tabpage(tp, id); } /* * Close a popup window with Window-id "id" in tabpage "tp". */ ! void popup_close_tabpage(tabpage_T *tp, int id) { win_T *wp; --- 2547,2573 ---- if (wp == curwin) { error_for_popup_window(); ! return FAIL; } if (prev == NULL) first_popupwin = wp->w_next; else prev->w_next = wp->w_next; popup_free(wp); ! return OK; } // go through tab-local popups FOR_ALL_TABPAGES(tp) ! if (popup_close_tabpage(tp, id) == OK) ! return OK; ! return FAIL; } /* * Close a popup window with Window-id "id" in tabpage "tp". */ ! int popup_close_tabpage(tabpage_T *tp, int id) { win_T *wp; *************** *** 2577,2591 **** if (wp == curwin) { error_for_popup_window(); ! return; } if (prev == NULL) *root = wp->w_next; else prev->w_next = wp->w_next; popup_free(wp); ! return; } } void --- 2580,2595 ---- if (wp == curwin) { error_for_popup_window(); ! return FAIL; } if (prev == NULL) *root = wp->w_next; else prev->w_next = wp->w_next; popup_free(wp); ! return OK; } + return FAIL; } void *************** *** 2594,2602 **** if (ERROR_IF_ANY_POPUP_WINDOW) return; while (first_popupwin != NULL) ! popup_close(first_popupwin->w_id); while (curtab->tp_first_popupwin != NULL) ! popup_close(curtab->tp_first_popupwin->w_id); } /* --- 2598,2608 ---- if (ERROR_IF_ANY_POPUP_WINDOW) return; while (first_popupwin != NULL) ! if (popup_close(first_popupwin->w_id) == FAIL) ! return; while (curtab->tp_first_popupwin != NULL) ! if (popup_close(curtab->tp_first_popupwin->w_id) == FAIL) ! return; } /* *** ../vim-8.2.0745/src/proto/popupwin.pro 2020-03-27 20:58:33.345005916 +0100 --- src/proto/popupwin.pro 2020-05-13 00:46:38.491537332 +0200 *************** *** 34,41 **** void f_popup_show(typval_T *argvars, typval_T *rettv); void f_popup_settext(typval_T *argvars, typval_T *rettv); int error_if_popup_window(int also_with_term); ! void popup_close(int id); ! void popup_close_tabpage(tabpage_T *tp, int id); void close_all_popups(void); void f_popup_move(typval_T *argvars, typval_T *rettv); void f_popup_setoptions(typval_T *argvars, typval_T *rettv); --- 34,41 ---- void f_popup_show(typval_T *argvars, typval_T *rettv); void f_popup_settext(typval_T *argvars, typval_T *rettv); int error_if_popup_window(int also_with_term); ! int popup_close(int id); ! int popup_close_tabpage(tabpage_T *tp, int id); void close_all_popups(void); void f_popup_move(typval_T *argvars, typval_T *rettv); void f_popup_setoptions(typval_T *argvars, typval_T *rettv); *** ../vim-8.2.0745/src/version.c 2020-05-12 23:45:12.172749473 +0200 --- src/version.c 2020-05-13 00:59:49.824457499 +0200 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 746, /**/ -- Momento mori, ergo carpe diem /// 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 ///