Mercurial > vim
comparison src/ex_docmd.c @ 30429:69ff2bd737a9 v9.0.0550
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Commit: https://github.com/vim/vim/commit/62de54b48d6354d4622ec0b21ffa4cf3cf312505
Author: zeertzjq <zeertzjq@outlook.com>
Date: Thu Sep 22 18:08:37 2022 +0100
patch 9.0.0550: crash when closing a tabpage and buffer is NULL
Problem: Crash when closing a tabpage and buffer is NULL.
Solution: Adjust how autocommands are triggered when closing a window.
(closes #11198, closes #11197)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 22 Sep 2022 19:15:03 +0200 |
parents | 48c73657679c |
children | 37aa9fd2ed72 |
comparison
equal
deleted
inserted
replaced
30428:e57e07951f98 | 30429:69ff2bd737a9 |
---|---|
6302 void | 6302 void |
6303 tabpage_close_other(tabpage_T *tp, int forceit) | 6303 tabpage_close_other(tabpage_T *tp, int forceit) |
6304 { | 6304 { |
6305 int done = 0; | 6305 int done = 0; |
6306 win_T *wp; | 6306 win_T *wp; |
6307 int h = tabline_height(); | |
6308 | 6307 |
6309 // Limit to 1000 windows, autocommands may add a window while we close | 6308 // Limit to 1000 windows, autocommands may add a window while we close |
6310 // one. OK, so I'm paranoid... | 6309 // one. OK, so I'm paranoid... |
6311 while (++done < 1000) | 6310 while (++done < 1000) |
6312 { | 6311 { |
6318 if (!valid_tabpage(tp) || tp->tp_firstwin == wp) | 6317 if (!valid_tabpage(tp) || tp->tp_firstwin == wp) |
6319 break; | 6318 break; |
6320 } | 6319 } |
6321 | 6320 |
6322 apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); | 6321 apply_autocmds(EVENT_TABCLOSED, NULL, NULL, FALSE, curbuf); |
6323 | |
6324 redraw_tabline = TRUE; | |
6325 if (h != tabline_height()) | |
6326 shell_new_rows(); | |
6327 } | 6322 } |
6328 | 6323 |
6329 /* | 6324 /* |
6330 * ":only". | 6325 * ":only". |
6331 */ | 6326 */ |