summaryrefslogtreecommitdiff
path: root/src/popupwin.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-05-13 01:04:32 +0200
committerBram Moolenaar <Bram@vim.org>2020-05-13 01:04:32 +0200
commitd502aa4c10771ec8eb570345ec5e124c4a4b7cd0 (patch)
tree130bc8dd333f4c229a120328999adc47c33c964c /src/popupwin.c
parent06f0853cb0b10364b22e5607fdecd35b3936e9ea (diff)
downloadvim-git-d502aa4c10771ec8eb570345ec5e124c4a4b7cd0.tar.gz
patch 8.2.0746: popup_clear() hangs when a popup can't be closedv8.2.0746
Problem: popup_clear() hangs when a popup can't be closed. Solution: Bail out when a popup can't be closed.
Diffstat (limited to 'src/popupwin.c')
-rw-r--r--src/popupwin.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 863439e83..5b346ac5b 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -2531,8 +2531,9 @@ error_if_popup_window(int also_with_term UNUSED)
/*
* Close a popup window by Window-id.
* Does not invoke the callback.
+ * Return OK if the popup was closed, FAIL otherwise.
*/
- void
+ int
popup_close(int id)
{
win_T *wp;
@@ -2546,25 +2547,27 @@ popup_close(int id)
if (wp == curwin)
{
error_for_popup_window();
- return;
+ return FAIL;
}
if (prev == NULL)
first_popupwin = wp->w_next;
else
prev->w_next = wp->w_next;
popup_free(wp);
- return;
+ return OK;
}
// go through tab-local popups
FOR_ALL_TABPAGES(tp)
- popup_close_tabpage(tp, id);
+ if (popup_close_tabpage(tp, id) == OK)
+ return OK;
+ return FAIL;
}
/*
* Close a popup window with Window-id "id" in tabpage "tp".
*/
- void
+ int
popup_close_tabpage(tabpage_T *tp, int id)
{
win_T *wp;
@@ -2577,15 +2580,16 @@ popup_close_tabpage(tabpage_T *tp, int id)
if (wp == curwin)
{
error_for_popup_window();
- return;
+ return FAIL;
}
if (prev == NULL)
*root = wp->w_next;
else
prev->w_next = wp->w_next;
popup_free(wp);
- return;
+ return OK;
}
+ return FAIL;
}
void
@@ -2594,9 +2598,11 @@ close_all_popups(void)
if (ERROR_IF_ANY_POPUP_WINDOW)
return;
while (first_popupwin != NULL)
- popup_close(first_popupwin->w_id);
+ if (popup_close(first_popupwin->w_id) == FAIL)
+ return;
while (curtab->tp_first_popupwin != NULL)
- popup_close(curtab->tp_first_popupwin->w_id);
+ if (popup_close(curtab->tp_first_popupwin->w_id) == FAIL)
+ return;
}
/*