From: Rich Felker <dalias@aerifal.cx>
To: bug-gnu-emacs@gnu.org
Subject: dired.c fails to gc protect lisp object (patch included)
Date: Sun, 11 Mar 2007 19:53:37 -0400 [thread overview]
Message-ID: <20070311235337.GA9566@brightrain.aerifal.cx> (raw)
[-- Attachment #1: Type: text/plain, Size: 262 bytes --]
i was experiencing random crashes because file_name_completion (in
dired.c) does not protect the "name" object from garbage collection.
the attached patch seems to fix it.
i'm using emacs-unicode-2 but this might apply to other versions as
well.
~rich felker
[-- Attachment #2: dired-gcpro.diff --]
[-- Type: text/plain, Size: 1141 bytes --]
Index: dired.c
===================================================================
RCS file: /sources/emacs/emacs/src/dired.c,v
retrieving revision 1.104.4.17
diff -u -r1.104.4.17 dired.c
--- dired.c 26 Jan 2007 06:15:08 -0000 1.104.4.17
+++ dired.c 11 Mar 2007 23:39:11 -0000
@@ -521,6 +521,7 @@
for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++)
{
int inner_count = SPECPDL_INDEX ();
+ struct gcpro gcpro1;
BLOCK_INPUT;
d = opendir (SDATA (Fdirectory_file_name (encoded_dir)));
@@ -665,6 +666,7 @@
}
else
name = make_string (dp->d_name, len);
+ GCPRO1(name);
/* Test the predicate, if any. */
@@ -673,7 +675,10 @@
Lisp_Object decoded;
decoded = Fexpand_file_name (DECODE_FILE (name), dirname);
if (NILP (call1 (predicate, decoded)))
- continue;
+ {
+ UNGCPRO;
+ continue;
+ }
}
/* Suitably record this match. */
@@ -736,6 +741,7 @@
matchsize++;
bestmatchsize = matchsize;
}
+ UNGCPRO;
}
/* This closes the directory. */
bestmatch = unbind_to (inner_count, bestmatch);
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs
next reply other threads:[~2007-03-11 23:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-11 23:53 Rich Felker [this message]
2007-03-12 4:24 ` dired.c fails to gc protect lisp object (patch included) Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070311235337.GA9566@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=bug-gnu-emacs@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).