mirror of
https://github.com/neovim/neovim.git
synced 2024-12-26 14:11:15 -07:00
Prevent preserve_exit() from executing more than once.
https://github.com/neovim/neovim/issues/563
This commit is contained in:
parent
d910ef2099
commit
85459327ba
@ -3373,12 +3373,15 @@ void preserve_exit(void)
|
|||||||
{
|
{
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
|
|
||||||
prepare_to_exit();
|
// Prevent repeated calls into this method.
|
||||||
|
if (really_exiting) {
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
/* Setting this will prevent free() calls. That avoids calling free()
|
|
||||||
* recursively when free() was invoked with a bad pointer. */
|
|
||||||
really_exiting = TRUE;
|
really_exiting = TRUE;
|
||||||
|
|
||||||
|
prepare_to_exit();
|
||||||
|
|
||||||
out_str(IObuff);
|
out_str(IObuff);
|
||||||
screen_start(); /* don't know where cursor is now */
|
screen_start(); /* don't know where cursor is now */
|
||||||
out_flush();
|
out_flush();
|
||||||
|
@ -139,8 +139,7 @@ static void deadly_signal(int signum)
|
|||||||
snprintf((char *)IObuff, sizeof(IObuff), "Vim: Caught deadly signal '%s'\n",
|
snprintf((char *)IObuff, sizeof(IObuff), "Vim: Caught deadly signal '%s'\n",
|
||||||
signal_name(signum));
|
signal_name(signum));
|
||||||
|
|
||||||
// Preserve files and exit. This sets the really_exiting flag to prevent
|
// Preserve files and exit.
|
||||||
// calling free().
|
|
||||||
preserve_exit();
|
preserve_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user