summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 6e2f097ae88..15cb9f29356 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1471,7 +1471,16 @@ with SIGHUP. */)
unlock_buffer (b);
#endif /* CLASH_DETECTION */
+ GCPRO1 (buf);
kill_buffer_processes (buf);
+ UNGCPRO;
+
+ /* Killing buffer processes may run sentinels which may
+ have called kill-buffer. */
+
+ if (NILP (b->name))
+ return Qnil;
+
clear_charpos_cache (b);
tem = Vinhibit_quit;
@@ -1644,6 +1653,8 @@ the current buffer's major mode. */)
int count;
Lisp_Object function;
+ CHECK_BUFFER (buffer);
+
if (STRINGP (XBUFFER (buffer)->name)
&& strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0)
function = find_symbol_value (intern ("initial-major-mode"));