forked from aniani/vim
patch 8.1.1259: crash when exiting early
Problem: Crash when exiting early. (Ralf Schandl) Solution: Only pop/push the title when it was set. (closes #4334)
This commit is contained in:
parent
9404a18ad9
commit
e5c83286bb
23
src/misc2.c
23
src/misc2.c
@ -1068,7 +1068,7 @@ free_all_mem(void)
|
|||||||
|
|
||||||
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
|
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
|
||||||
p_ea = FALSE;
|
p_ea = FALSE;
|
||||||
if (first_tabpage->tp_next != NULL)
|
if (first_tabpage != NULL && first_tabpage->tp_next != NULL)
|
||||||
do_cmdline_cmd((char_u *)"tabonly!");
|
do_cmdline_cmd((char_u *)"tabonly!");
|
||||||
if (!ONE_WINDOW)
|
if (!ONE_WINDOW)
|
||||||
do_cmdline_cmd((char_u *)"only!");
|
do_cmdline_cmd((char_u *)"only!");
|
||||||
@ -1085,15 +1085,18 @@ free_all_mem(void)
|
|||||||
// Clear user commands (before deleting buffers).
|
// Clear user commands (before deleting buffers).
|
||||||
ex_comclear(NULL);
|
ex_comclear(NULL);
|
||||||
|
|
||||||
|
// When exiting from mainerr_arg_missing curbuf has not been initialized,
|
||||||
|
// and not much else.
|
||||||
|
if (curbuf != NULL)
|
||||||
|
{
|
||||||
# ifdef FEAT_MENU
|
# ifdef FEAT_MENU
|
||||||
/* Clear menus. */
|
// Clear menus.
|
||||||
do_cmdline_cmd((char_u *)"aunmenu *");
|
do_cmdline_cmd((char_u *)"aunmenu *");
|
||||||
# ifdef FEAT_MULTI_LANG
|
# ifdef FEAT_MULTI_LANG
|
||||||
do_cmdline_cmd((char_u *)"menutranslate clear");
|
do_cmdline_cmd((char_u *)"menutranslate clear");
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
// Clear mappings, abbreviations, breakpoints.
|
||||||
/* Clear mappings, abbreviations, breakpoints. */
|
|
||||||
do_cmdline_cmd((char_u *)"lmapclear");
|
do_cmdline_cmd((char_u *)"lmapclear");
|
||||||
do_cmdline_cmd((char_u *)"xmapclear");
|
do_cmdline_cmd((char_u *)"xmapclear");
|
||||||
do_cmdline_cmd((char_u *)"mapclear");
|
do_cmdline_cmd((char_u *)"mapclear");
|
||||||
@ -1108,6 +1111,7 @@ free_all_mem(void)
|
|||||||
# if defined(FEAT_KEYMAP)
|
# if defined(FEAT_KEYMAP)
|
||||||
do_cmdline_cmd((char_u *)"set keymap=");
|
do_cmdline_cmd((char_u *)"set keymap=");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
# ifdef FEAT_TITLE
|
# ifdef FEAT_TITLE
|
||||||
free_titles();
|
free_titles();
|
||||||
@ -1142,6 +1146,7 @@ free_all_mem(void)
|
|||||||
set_expr_line(NULL);
|
set_expr_line(NULL);
|
||||||
# endif
|
# endif
|
||||||
# ifdef FEAT_DIFF
|
# ifdef FEAT_DIFF
|
||||||
|
if (curtab != NULL)
|
||||||
diff_clear(curtab);
|
diff_clear(curtab);
|
||||||
# endif
|
# endif
|
||||||
clear_sb_text(TRUE); /* free any scrollback text */
|
clear_sb_text(TRUE); /* free any scrollback text */
|
||||||
@ -1172,16 +1177,17 @@ free_all_mem(void)
|
|||||||
tabpage_T *tab;
|
tabpage_T *tab;
|
||||||
|
|
||||||
qf_free_all(NULL);
|
qf_free_all(NULL);
|
||||||
/* Free all location lists */
|
// Free all location lists
|
||||||
FOR_ALL_TAB_WINDOWS(tab, win)
|
FOR_ALL_TAB_WINDOWS(tab, win)
|
||||||
qf_free_all(win);
|
qf_free_all(win);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Close all script inputs. */
|
// Close all script inputs.
|
||||||
close_all_scripts();
|
close_all_scripts();
|
||||||
|
|
||||||
/* Destroy all windows. Must come before freeing buffers. */
|
if (curwin != NULL)
|
||||||
|
// Destroy all windows. Must come before freeing buffers.
|
||||||
win_free_all();
|
win_free_all();
|
||||||
|
|
||||||
/* Free all option values. Must come after closing windows. */
|
/* Free all option values. Must come after closing windows. */
|
||||||
@ -1223,8 +1229,11 @@ free_all_mem(void)
|
|||||||
|
|
||||||
reset_last_sourcing();
|
reset_last_sourcing();
|
||||||
|
|
||||||
|
if (first_tabpage != NULL)
|
||||||
|
{
|
||||||
free_tabpage(first_tabpage);
|
free_tabpage(first_tabpage);
|
||||||
first_tabpage = NULL;
|
first_tabpage = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
# ifdef UNIX
|
# ifdef UNIX
|
||||||
/* Machine-specific free. */
|
/* Machine-specific free. */
|
||||||
|
@ -2205,14 +2205,19 @@ mch_settitle(char_u *title, char_u *icon)
|
|||||||
void
|
void
|
||||||
mch_restore_title(int which)
|
mch_restore_title(int which)
|
||||||
{
|
{
|
||||||
|
int do_push_pop = did_set_title || did_set_icon;
|
||||||
|
|
||||||
/* only restore the title or icon when it has been set */
|
/* only restore the title or icon when it has been set */
|
||||||
mch_settitle(((which & SAVE_RESTORE_TITLE) && did_set_title) ?
|
mch_settitle(((which & SAVE_RESTORE_TITLE) && did_set_title) ?
|
||||||
(oldtitle ? oldtitle : p_titleold) : NULL,
|
(oldtitle ? oldtitle : p_titleold) : NULL,
|
||||||
((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
|
((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL);
|
||||||
|
|
||||||
|
if (do_push_pop)
|
||||||
|
{
|
||||||
// pop and push from/to the stack
|
// pop and push from/to the stack
|
||||||
term_pop_title(which);
|
term_pop_title(which);
|
||||||
term_push_title(which);
|
term_push_title(which);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_TITLE */
|
#endif /* FEAT_TITLE */
|
||||||
|
@ -2860,6 +2860,7 @@ found_tagfile_cb(char_u *fname, void *cookie UNUSED)
|
|||||||
free_tag_stuff(void)
|
free_tag_stuff(void)
|
||||||
{
|
{
|
||||||
ga_clear_strings(&tag_fnames);
|
ga_clear_strings(&tag_fnames);
|
||||||
|
if (curwin != NULL)
|
||||||
do_tag(NULL, DT_FREE, 0, 0, 0);
|
do_tag(NULL, DT_FREE, 0, 0, 0);
|
||||||
tag_freematch();
|
tag_freematch();
|
||||||
|
|
||||||
|
@ -1045,6 +1045,7 @@ ex_command(exarg_T *eap)
|
|||||||
ex_comclear(exarg_T *eap UNUSED)
|
ex_comclear(exarg_T *eap UNUSED)
|
||||||
{
|
{
|
||||||
uc_clear(&ucmds);
|
uc_clear(&ucmds);
|
||||||
|
if (curbuf != NULL)
|
||||||
uc_clear(&curbuf->b_ucmds);
|
uc_clear(&curbuf->b_ucmds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -767,6 +767,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1259,
|
||||||
/**/
|
/**/
|
||||||
1258,
|
1258,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user