From: Dmitry Antipov Date: Wed, 4 Jul 2012 15:49:46 +0000 (+0400) Subject: * buffer.c (init_buffer_once): Fix initialization of X-Git-Tag: emacs-24.2.90~1199^2~224 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3884d954f32acb816332d7837fe813bc546f6268;p=emacs.git * buffer.c (init_buffer_once): Fix initialization of headers for buffer_defaults and buffer_local_symbols. Reported by Juanma Barranquero . --- diff --git a/src/ChangeLog b/src/ChangeLog index 70f7fedf5ad..deac87ffca2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-07-04 Dmitry Antipov + + * buffer.c (init_buffer_once): Fix initialization of + headers for buffer_defaults and buffer_local_symbols. + Reported by Juanma Barranquero . + 2012-07-04 Stefan Monnier Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE. diff --git a/src/buffer.c b/src/buffer.c index 1e68d7d6b74..e1652e9e105 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -4870,6 +4870,12 @@ void init_buffer_once (void) { int idx; + /* If you add, remove, or reorder Lisp_Objects in a struct buffer, make + sure that this is still correct. Otherwise, mark_vectorlike may not + trace all Lisp_Objects in buffer_defaults and buffer_local_symbols. */ + const int pvecsize + = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header)) + / sizeof (Lisp_Object); memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags); @@ -4886,9 +4892,9 @@ init_buffer_once (void) buffer_local_symbols.text = &buffer_local_symbols.own_text; BUF_INTERVALS (&buffer_defaults) = 0; BUF_INTERVALS (&buffer_local_symbols) = 0; - XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0); + XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); XSETBUFFER (Vbuffer_defaults, &buffer_defaults); - XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0); + XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); /* Set up the default values of various buffer slots. */