emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs crashes accidentally


From: Richard Stallman
Subject: Re: Emacs crashes accidentally
Date: Fri, 08 Sep 2006 11:12:46 -0400

    Looks like a GC violation.  See the comment for message_nolog:

       This may GC (insert may run before/after change hooks),
       so the buffer M must NOT point to a Lisp string.  */

You're right.  In fact, that's not the only thing in strout
that is likely to cause lossage if GC relocates the string.

print_string is supposed to be the function to use for a Lisp string.
So I think the bug is that print_string calls strout in a case where
that is not safe.

Does this fix it?


*** print.c     08 Sep 2006 07:47:26 -0400      1.227
--- print.c     08 Sep 2006 10:37:18 -0400      
***************
*** 497,506 ****
        else
        chars = SBYTES (string);
  
!       /* strout is safe for output to a frame (echo area) or to print_buffer. 
 */
!       strout (SDATA (string),
!             chars, SBYTES (string),
!             printcharfun, STRING_MULTIBYTE (string));
      }
    else
      {
--- 497,524 ----
        else
        chars = SBYTES (string);
  
!       if (EQ (printcharfun, Qt))
!       {
!         int nbytes = SBYTES (string);
!         char *buffer;
! 
!         /* Output to echo area.  Copy the string contents so that
!            relocation by GC does not cause trouble.  */
!         USE_SAFE_ALLOCA;
! 
!         SAFE_ALLOCA (buffer, char *, nbytes);
!         bcopy (SDATA (string), buffer, nbytes);
! 
!         strout (buffer, chars, SBYTES (string),
!                 printcharfun, STRING_MULTIBYTE (string));
! 
!         SAFE_FREE ();
!       }
!       else
!       /* strout is safe for output to print_buffer.  */
!       strout (SDATA (string),
!               chars, SBYTES (string),
!               printcharfun, STRING_MULTIBYTE (string));
      }
    else
      {




reply via email to

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