Subject: Re: bug#15282: 24.3.50; Starting a new emacsclient -t instance with another instance running in a separate terminal causes display corruption in the first instance.

From: Eli Zaretskii <[email-masked]>
Date: Fri, 06 Sep 2013 13:16:09 +0300

> Date: Fri, 6 Sep 2013 09:46:17 +0800
> From: Chow Loong Jin <[email-masked]>
> 
> 1. Start the daemon: emacs -Q --daemon
> 2. Start emacsclient: emacsclient -t
> 3. Open a new terminal, and start another emacsclient instance:
>    emacsclient -t
> 4. Go back to the first emacsclient instance, and notice that there's
>    some text corruption that can't be cleared without closing that
>    emacsclient instance. ^Z followed by fg doesn't get rid of the issue
>    either.

The reason seems to be this commit:

   revno: 114012
   author: Paul Eggert  <[email-masked]>
   committer: Paul Eggert <[email-masked]>
   branch nick: trunk
   timestamp: Mon 2013-08-26 18:10:30 +0000
   message:
     Fix unlikely core dump in init_tty, and simplify terminfo case.

     * term.c (init_tty) [TERMINFO]: Fix check for buffer overrun.
     The old version incorrectly dumped core if malloc returned a
     buffer containing only non-NUL bytes.
     (init_tty): Do not allocate or free termcap buffers; the
     struct does that for us now.
     * termchar.h (TERMCAP_BUFFER_SIZE) [!TERMINFO]: New constant.
     (struct tty_display_info): Define members termcap_term_buffer and
     termcap_strings_buffer only if !TERMINFO, since terminfo doesn't
     use them.  Allocate them directly in struct rather than indirectly
     via a pointer, to simplify init_tty.

Paul, could you take a look, please?