all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: herberteuler@hotmail.com, emacs-devel@gnu.org
Subject: Re: Emacs crashes accidentally
Date: Fri, 08 Sep 2006 11:12:46 -0400	[thread overview]
Message-ID: <E1GLi2A-0008Ml-KT@fencepost.gnu.org> (raw)
In-Reply-To: <je4pvirbeb.fsf@sykes.suse.de> (message from Andreas Schwab on Fri, 08 Sep 2006 10:49:16 +0200)

    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	other threads:[~2006-09-08 15:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-09  9:37 Emacs crashes accidentally Herbert Euler
2006-08-10 16:27 ` Richard Stallman
2006-09-06 12:50   ` Herbert Euler
2006-09-07 10:13     ` Herbert Euler
2006-09-08 11:55       ` Richard Stallman
2006-09-08 13:32         ` Herbert Euler
2006-09-08 13:38           ` David Kastrup
2006-09-08 13:46             ` Herbert Euler
2006-09-07 21:15     ` Richard Stallman
2006-09-08  2:50       ` Herbert Euler
2006-09-08  8:49         ` Andreas Schwab
2006-09-08 15:12           ` Richard Stallman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1GLi2A-0008Ml-KT@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=herberteuler@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.