[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
readevalloop and GC
From: |
Kyotaro HORIGUCHI |
Subject: |
readevalloop and GC |
Date: |
Mon, 14 Nov 2005 02:25:03 +0900 (JST) |
User-agent: |
Mew version 4.2.54 on Emacs 22.0 / Mule 5.0 (榊) / Meadow-3.00-dev (菊) |
In readevalloop() in lread.c creates marker object in every turn
of the loop when start is not nil, and the marker is not
GC-protected.
So, it may be freed by GC happened in evalfun (is typically
Feval) called just after.
lread.c:1410
| if (!NILP (start) && continue_reading_p)
| start = Fpoint_marker ();
| unbind_to (count1, Qnil);
|
| val = (*evalfun) (val); ;; GC will happen.
This problem was fixed by following patch.
BTW, I have seen the problem on Meadow when doing eval-region in
ps-print.el, but not on emacs.
--
Kyotaro HORIGUCHI
====
Index: lread.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/lread.c,v
retrieving revision 1.342
diff -u -2 -r1.342 lread.c
--- lread.c 1 Nov 2005 19:46:16 -0000 1.342
+++ lread.c 13 Nov 2005 17:17:27 -0000
@@ -1317,5 +1317,5 @@
register Lisp_Object val;
int count = SPECPDL_INDEX ();
- struct gcpro gcpro1;
+ struct gcpro gcpro1, gcpro2;
struct buffer *b = 0;
int continue_reading_p;
@@ -1333,5 +1333,17 @@
readchar_backlog = -1;
- GCPRO1 (sourcename);
+ if (! NILP (start))
+ {
+ if (NUMBERP (start))
+ {
+ Lisp_Object tmp = start;
+ start = Fmake_marker ();
+ Fset_marker (start, tmp, Qnil);
+ }
+ else if (! MARKERP (start))
+ wrong_type_argument (Qinteger_or_marker_p, start);
+ }
+
+ GCPRO2 (sourcename, start);
LOADHIST_ATTACH (sourcename);
@@ -1401,5 +1413,5 @@
if (!NILP (start) && continue_reading_p)
- start = Fpoint_marker ();
+ set_marker_both (start , Qnil, PT, PT_BYTE);
unbind_to (count1, Qnil);
- readevalloop and GC,
Kyotaro HORIGUCHI <=