Subject: Re: bug#1052: segfault when resuming emacsclient -t in an xterm

From: Dan Nicolaescu <[email-masked]>
Date: Tue, 30 Sep 2008 11:18:16 -0700 (PDT)

Chong Yidong <[email-masked]> writes:

  > > The problem is that after the cited change
  > > `xterm-remove-modify-other-keys' calls `terminal-live-p' (it was
  > > previously using `frame-live-p') before calling
  > > `send-string-to-terminal'.
  > >
  > > `terminal-live-p' does not return false when tty->output is NULL --->
  > > KABOOM.
  > 
  > Looks like it's just a matter of checking tty->output, then.  WDYT?

Not sure it's a good idea.
The test for `frame-live-p' was trying to make sure that the frame is OK
and `send-string-to-terminal' would work.  

Not sure
 1.  why was it replaced with `terminal-live-p'
 2.  maybe `terminal-live-p' needs to be changed to detect this condition

  > *** trunk/src/dispnew.c.~1.419.~	2008-09-28 16:09:43.000000000 -0400
  > --- trunk/src/dispnew.c	2008-09-30 13:02:21.000000000 -0400
  > ***************
  > *** 6470,6477 ****
  >         fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
  >         fflush (tty->termscript);
  >       }
  > !   fwrite (SDATA (string), 1, SBYTES (string), tty->output);
  > !   fflush (tty->output);
  >     UNBLOCK_INPUT;
  >     return Qnil;
  >   }
  > --- 6470,6480 ----
  >         fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
  >         fflush (tty->termscript);
  >       }
  > !   if (tty->output)
  > !     {
  > !       fwrite (SDATA (string), 1, SBYTES (string), tty->output);
  > !       fflush (tty->output);
  > !     }
  >     UNBLOCK_INPUT;
  >     return Qnil;
  >   }