Mercurial > hg > xemacs-beta
diff src/buffer.c @ 116:9f59509498e1 r20-1b10
Import from CVS: tag r20-1b10
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:23:06 +0200 |
parents | 8619ce7e4c50 |
children | cca96a509cfe |
line wrap: on
line diff
--- a/src/buffer.c Mon Aug 13 09:21:56 2007 +0200 +++ b/src/buffer.c Mon Aug 13 09:23:06 2007 +0200 @@ -1216,7 +1216,7 @@ */ (bufname)) { - /* This function can GC */ + /* This function can call lisp */ Lisp_Object buf; REGISTER struct buffer *b; struct gcpro gcpro1, gcpro2; @@ -1384,7 +1384,26 @@ && BUF_SAVE_MODIFF (b) < b->auto_save_modified) { if (!NILP (Vdelete_auto_save_files)) - internal_delete_file (b->auto_save_file_name); + { + /* deleting the auto save file might kill b! */ + /* #### dmoore - fix this crap, we do this same gcpro and + buffer liveness check multiple times. Let's get a + macro or something for it. */ + GCPRO1 (buf); + internal_delete_file (b->auto_save_file_name); + UNGCPRO; + b = XBUFFER (buf); + + if (!BUFFER_LIVE_P (b)) + return Qnil; + + if (b == current_buffer) + { + Fset_buffer (Fother_buffer (buf, Qnil, Qnil)); + if (b == current_buffer) + return Qnil; + } + } } uninit_buffer_markers (b);