summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2012-07-12 09:12:24 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2012-07-12 09:12:24 +0200
commit8a05d57a7d691085200b64f5e56a6232e78c6ac4 (patch)
treea80cbb2711df071feb7c2f2997a8e1ef7e437520
parent9598ddae26dfdd5bbdb2aa901ef889ce1723a0e3 (diff)
downloademacs-8a05d57a7d691085200b64f5e56a6232e78c6ac4.tar.gz
Fixes: debbugs:11917
Fix crash when creating indirect buffer * buffer.c (buffer_lisp_local_variables): Add argument CLONE. Don't handle unbound variables specially if non-zero. (Fbuffer_local_variables): Pass zero. (clone_per_buffer_values): Pass non-zero.
-rw-r--r--src/ChangeLog8
-rw-r--r--src/buffer.c14
2 files changed, 16 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ea44367e2bd..7274fc4e4d8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2012-07-12 Andreas Schwab <schwab@linux-m68k.org>
+
+ Fix crash when creating indirect buffer (Bug#11917)
+ * buffer.c (buffer_lisp_local_variables): Add argument CLONE.
+ Don't handle unbound variables specially if non-zero.
+ (Fbuffer_local_variables): Pass zero.
+ (clone_per_buffer_values): Pass non-zero.
+
2012-06-28 Andreas Schwab <schwab@linux-m68k.org>
* gnutls.c (emacs_gnutls_handshake): Revert last change. Add QUIT
diff --git a/src/buffer.c b/src/buffer.c
index ac14ec9c37c..88ef34070ea 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -156,7 +156,7 @@ static void alloc_buffer_text (struct buffer *, ptrdiff_t);
static void free_buffer_text (struct buffer *b);
static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT);
-static Lisp_Object buffer_lisp_local_variables (struct buffer *);
+static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
/* For debugging; temporary. See set_buffer_internal. */
/* Lisp_Object Qlisp_mode, Vcheck_symbol; */
@@ -505,7 +505,7 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
/* Get (a copy of) the alist of Lisp-level local variables of FROM
and install that in TO. */
- BVAR (to, local_var_alist) = buffer_lisp_local_variables (from);
+ BVAR (to, local_var_alist) = buffer_lisp_local_variables (from, 1);
}
@@ -1003,10 +1003,12 @@ is the default binding of the variable. */)
/* Return an alist of the Lisp-level buffer-local bindings of
buffer BUF. That is, don't include the variables maintained
- in special slots in the buffer object. */
+ in special slots in the buffer object.
+ If CLONE is zero elements of the form (VAR . unbound) are replaced
+ by VAR. */
static Lisp_Object
-buffer_lisp_local_variables (struct buffer *buf)
+buffer_lisp_local_variables (struct buffer *buf, int clone)
{
Lisp_Object result = Qnil;
register Lisp_Object tail;
@@ -1026,7 +1028,7 @@ buffer_lisp_local_variables (struct buffer *buf)
if (buf != current_buffer)
val = XCDR (elt);
- result = Fcons (EQ (val, Qunbound)
+ result = Fcons (!clone && EQ (val, Qunbound)
? XCAR (elt)
: Fcons (XCAR (elt), val),
result);
@@ -1055,7 +1057,7 @@ No argument or nil as argument means use current buffer as BUFFER. */)
buf = XBUFFER (buffer);
}
- result = buffer_lisp_local_variables (buf);
+ result = buffer_lisp_local_variables (buf, 0);
/* Add on all the variables stored in special slots. */
{