with-display-message: Workaround for bug#63253
Running arbitrary ELisp code from an atimer is still dangerous, at least because the regexp engine is not-reentrant, so let's patch up the case we bumped into. There are probably many other such holes :-( * src/alloc.c (garbage_collection_inhibited): Make it non-static. * src/xdisp.c (garbage_collection_inhibited): Declare it. (set_message, clear_message): Use it as a proxy for "we're in a dangerous context like within `probably_quit`".
This commit is contained in:
parent
6924c81a6d
commit
93005cd9dc
2 changed files with 11 additions and 3 deletions
|
@ -367,7 +367,7 @@ static ptrdiff_t pure_bytes_used_non_lisp;
|
||||||
|
|
||||||
/* If positive, garbage collection is inhibited. Otherwise, zero. */
|
/* If positive, garbage collection is inhibited. Otherwise, zero. */
|
||||||
|
|
||||||
static intptr_t garbage_collection_inhibited;
|
intptr_t garbage_collection_inhibited;
|
||||||
|
|
||||||
/* The GC threshold in bytes, the last time it was calculated
|
/* The GC threshold in bytes, the last time it was calculated
|
||||||
from gc-cons-threshold and gc-cons-percentage. */
|
from gc-cons-threshold and gc-cons-percentage. */
|
||||||
|
|
12
src/xdisp.c
12
src/xdisp.c
|
@ -12810,6 +12810,8 @@ truncate_message_1 (void *a1, Lisp_Object a2)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern intptr_t garbage_collection_inhibited;
|
||||||
|
|
||||||
/* Set the current message to STRING. */
|
/* Set the current message to STRING. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -12819,7 +12821,11 @@ set_message (Lisp_Object string)
|
||||||
|
|
||||||
eassert (STRINGP (string));
|
eassert (STRINGP (string));
|
||||||
|
|
||||||
if (FUNCTIONP (Vset_message_function))
|
if (FUNCTIONP (Vset_message_function)
|
||||||
|
/* FIXME: (bug#63253) We should really make the regexp engine re-entrant,
|
||||||
|
but in the mean time, let's ignore `set-message-function` when
|
||||||
|
called from `probably_quit`. */
|
||||||
|
&& !garbage_collection_inhibited)
|
||||||
{
|
{
|
||||||
specpdl_ref count = SPECPDL_INDEX ();
|
specpdl_ref count = SPECPDL_INDEX ();
|
||||||
specbind (Qinhibit_quit, Qt);
|
specbind (Qinhibit_quit, Qt);
|
||||||
|
@ -12896,7 +12902,9 @@ clear_message (bool current_p, bool last_displayed_p)
|
||||||
|
|
||||||
if (current_p)
|
if (current_p)
|
||||||
{
|
{
|
||||||
if (FUNCTIONP (Vclear_message_function))
|
if (FUNCTIONP (Vclear_message_function)
|
||||||
|
/* FIXME: (bug#63253) Same as for `set-message-function` above. */
|
||||||
|
&& !garbage_collection_inhibited)
|
||||||
{
|
{
|
||||||
specpdl_ref count = SPECPDL_INDEX ();
|
specpdl_ref count = SPECPDL_INDEX ();
|
||||||
specbind (Qinhibit_quit, Qt);
|
specbind (Qinhibit_quit, Qt);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue