bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#32038: 27.0.50; Emacs hangs when using :propertize mode line constru


From: Jonathan Kyle Mitchell
Subject: bug#32038: 27.0.50; Emacs hangs when using :propertize mode line construct and not providing a property value
Date: Wed, 04 Jul 2018 23:14:01 -0500

On Wed, 2018-07-04 at 18:07 +0300, Eli Zaretskii wrote:
> > From: Jonathan Kyle Mitchell <kyle@jonathanmitchell.org>
> > Date: Tue, 03 Jul 2018 22:12:57 -0500
> > Cc: 32038@debbugs.gnu.org
> > 
> > I think I found a way to make redisplay ignore any malformed
> > property list by
> > putting a single check around Fset_text_properties in xdisp.c. The
> > text of the
> > modeline is still set according to the provided string, but the
> > property list
> > is ignored if it doesn't have an even number of elements. It
> > doesn't
> > infinitely loop anymore given a malformed property list.
> 
> Thanks, but I think we should log the error in *Messages*, because
> otherwise the error will go unnoticed.
> 
> > +               if (EQ (Fmod (Flength (props), make_number
> > (2)),
> > +                       make_number (0)))
> 
> We are on the C level, so it is easier/simpler to do this instead:
> 
>   ptrdiff_t seqlen = XFASTINT (Flength (props));
>   if (seqlen % 2 == 0)
>     Fset_text_properties (...);
> 
> More importantly, Flength can signal an error if PROPS is too long,
> so
> I'm not sure the idea of your patch is 100% correct, because the code
> you propose can still signal an error.  An alternative would be to
> call Fset_text_properties via internal_condition_case_n, like we do
> in
> safe__call.

That makes sense. I added one function to call Fset_text_properties
through internal_condition_case_n in the attached revised patch. The
error gets caught and safe_eval_handler appends an error message to the
*Messages* buffer.

The error message is put in *Messages* on the first time only though,
subsequent (force-mode-line-update) calls just append nil. I don't know
if that's expected for redisplay's internal messaging routines.

Thanks for reviewing the patch.

--
Jonathan Kyle Mitchell

Attachment: 0001-Call-Fset_text_properties-through-internal_condition.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]