forked from aniani/vim
updated for version 7.4.022
Problem: Deadlock while exiting, because of allocating memory. Solution: Do not use gettext() in deathtrap(). (James McCoy)
This commit is contained in:
parent
9be4481892
commit
bec9c20884
@ -9174,6 +9174,8 @@ prepare_to_exit()
|
|||||||
/*
|
/*
|
||||||
* Preserve files and exit.
|
* Preserve files and exit.
|
||||||
* When called IObuff must contain a message.
|
* When called IObuff must contain a message.
|
||||||
|
* NOTE: This may be called from deathtrap() in a signal handler, avoid unsafe
|
||||||
|
* functions, such as allocating memory.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
preserve_exit()
|
preserve_exit()
|
||||||
@ -9196,7 +9198,7 @@ preserve_exit()
|
|||||||
{
|
{
|
||||||
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
|
if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL)
|
||||||
{
|
{
|
||||||
OUT_STR(_("Vim: preserving files...\n"));
|
OUT_STR("Vim: preserving files...\n");
|
||||||
screen_start(); /* don't know where cursor is now */
|
screen_start(); /* don't know where cursor is now */
|
||||||
out_flush();
|
out_flush();
|
||||||
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
|
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
|
||||||
@ -9206,7 +9208,7 @@ preserve_exit()
|
|||||||
|
|
||||||
ml_close_all(FALSE); /* close all memfiles, without deleting */
|
ml_close_all(FALSE); /* close all memfiles, without deleting */
|
||||||
|
|
||||||
OUT_STR(_("Vim: Finished.\n"));
|
OUT_STR("Vim: Finished.\n");
|
||||||
|
|
||||||
getout(1);
|
getout(1);
|
||||||
}
|
}
|
||||||
|
@ -957,8 +957,10 @@ mch_didjmp()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* This function handles deadly signals.
|
* This function handles deadly signals.
|
||||||
* It tries to preserve any swap file and exit properly.
|
* It tries to preserve any swap files and exit properly.
|
||||||
* (partly from Elvis).
|
* (partly from Elvis).
|
||||||
|
* NOTE: Avoid unsafe functions, such as allocating memory, they can result in
|
||||||
|
* a deadlock.
|
||||||
*/
|
*/
|
||||||
static RETSIGTYPE
|
static RETSIGTYPE
|
||||||
deathtrap SIGDEFARG(sigarg)
|
deathtrap SIGDEFARG(sigarg)
|
||||||
@ -1090,18 +1092,23 @@ deathtrap SIGDEFARG(sigarg)
|
|||||||
}
|
}
|
||||||
if (entered == 2)
|
if (entered == 2)
|
||||||
{
|
{
|
||||||
OUT_STR(_("Vim: Double signal, exiting\n"));
|
/* No translation, it may call malloc(). */
|
||||||
|
OUT_STR("Vim: Double signal, exiting\n");
|
||||||
out_flush();
|
out_flush();
|
||||||
getout(1);
|
getout(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* No translation, it may call malloc(). */
|
||||||
#ifdef SIGHASARG
|
#ifdef SIGHASARG
|
||||||
sprintf((char *)IObuff, _("Vim: Caught deadly signal %s\n"),
|
sprintf((char *)IObuff, "Vim: Caught deadly signal %s\n",
|
||||||
signal_info[i].name);
|
signal_info[i].name);
|
||||||
#else
|
#else
|
||||||
sprintf((char *)IObuff, _("Vim: Caught deadly signal\n"));
|
sprintf((char *)IObuff, "Vim: Caught deadly signal\n");
|
||||||
#endif
|
#endif
|
||||||
preserve_exit(); /* preserve files and exit */
|
|
||||||
|
/* Preserve files and exit. This sets the really_exiting flag to prevent
|
||||||
|
* calling free(). */
|
||||||
|
preserve_exit();
|
||||||
|
|
||||||
#ifdef NBDEBUG
|
#ifdef NBDEBUG
|
||||||
reset_signals();
|
reset_signals();
|
||||||
|
@ -738,6 +738,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 */
|
||||||
|
/**/
|
||||||
|
22,
|
||||||
/**/
|
/**/
|
||||||
21,
|
21,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user