emacs-devel
[Top][All Lists]
Advanced

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

Re: Emacs 22.2.90 pretest


From: YAMAMOTO Mitsuharu
Subject: Re: Emacs 22.2.90 pretest
Date: Thu, 21 Aug 2008 15:16:00 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.2.90 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Thu, 21 Aug 2008 08:35:11 +0300, Eli Zaretskii <address@hidden> said:

>> > Please suggest which variables to GCPRO.
>> 
>> GCPRO doesn't help here.  It just protects Lisp Objects from being
>> collected, but not for Lisp String contents from being relocated.

> Really? that's news to me.

Yes.  It seems to be a common misunderstanding.

http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-03/msg00034.html

This can cause and has actually been caused nasty bugs that are
difficult to reproduce or debug.  So every developer should be aware
of this.

  GCPRO1 (s);
  p = SDATA (s);
  SOME_OPERATION_INVOLVING_GC; /* e.g., DECODE_FILE, ENCODE_UTF_8 */
  /* p no longer points to valid data if GC happened.  */
  /* One should do p = SDATA (s) again before using p.  */

> So what means do we have for protecting pointers to Lisp strings
> from GC?

Nothing can prevent Lisp String contents from being relocated by GC.

>> Yes, `nm' is not corrupted if DOS_NT because of copying.  But
>> otherwise, it may be corrupted by GC and it is actually used
>> afterwards.
>> 
>> 1455 if (1 1456 #ifndef DOS_NT 1457 /* /... alone is not absolute
>> on DOS and Windows. */ 1458 && !IS_DIRECTORY_SEP (nm[0]) 1459
>> #endif

> Is nm the only variable in danger?  If so, how about if we simply
> copy it on all platforms?

I think it is one possible solution if properly commented.

                                     YAMAMOTO Mitsuharu
                                address@hidden




reply via email to

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