Subject: Re: bug#5984: Crash displaying composed characters

From: Eli Zaretskii <[email-masked]>
Date: Tue, 20 Apr 2010 22:18:40 +0300

> Date: Tue, 20 Apr 2010 20:29:29 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: 
> 
>   . The call to auto-composition-function loads uni-combining.el.  And
>     because force-load-messages is non-nil, that displays the 2
>     messages
> 
>       Loading lisp/international/uni-combining.el (source)...
>       Loading lisp/international/uni-combining.el (source)...done
> 
>   . Now the " *Echo Area0*" buffer holds a totally different text,
>     unbeknownst to autocmp_chars, which still passes the old values 32
>     and 33 to TEMP_SET_PT_BOTH:
> 
> 	  if (NILP (string))
> 	    TEMP_SET_PT_BOTH (pt, pt_byte);
> 	  return unbind_to (count, gstring);
> 
>   . temp_set_pt_both uses BUF_ZV and BUF_ZV_BYTE to validate its
>     argument, but now BUF_ZV and BUF_ZV_BYTE correspond to the text
>     "Loading ...", which has an entirely different length and
>     contents, and the validation fails.  Therefore, temp_set_pt_both
>     aborts.
> 
> One kludgy way of fixing this would be to bind force-load-messages to
> nil around the call to auto-composition-function.  But that sounds too
> harsh: after all, whoever sets that variable, actually wants to see
> all these messages.
> 
> Another way is to force the "Loading..." messages use the second echo
> area buffer.  Do we have ways to do something like that?
> 
> Ideas are welcome.

Here's one idea: use push_message and restore_message to save and
restore the current echo area message around the call to
auto-composition-function.  WDYT?