From: Dmitry Antipov Date: Tue, 21 Jan 2014 02:28:57 +0000 (+0400) Subject: * buffer.c (Fkill_buffer): When killing an indirect buffer, X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~317 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5004c3bfbb0e3bbaa7d91658eee04d2d4daef663;p=emacs.git * buffer.c (Fkill_buffer): When killing an indirect buffer, re-attach intervals to its base buffer (Bug#16502). * intervals.c (set_interval_object): Move from here... * intervals.h (set_interval_object): ... to here. Fix comments. --- diff --git a/src/ChangeLog b/src/ChangeLog index ac7624ee4ab..99a3e7e7299 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2014-01-21 Dmitry Antipov + + * buffer.c (Fkill_buffer): When killing an indirect buffer, + re-attach intervals to its base buffer (Bug#16502). + * intervals.c (set_interval_object): Move from here... + * intervals.h (set_interval_object): ... to here. Fix comments. + 2014-01-20 Paul Eggert Avoid undefined behavior by initializing buffer redisplay bit. diff --git a/src/buffer.c b/src/buffer.c index 8f557634b2a..33bd80d3f4f 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1868,6 +1868,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) if (b->base_buffer) { + INTERVAL i; /* Unchain all markers that belong to this indirect buffer. Don't unchain the markers that belong to the base buffer or its other indirect buffers. */ @@ -1882,6 +1883,14 @@ cleaning up all windows currently displaying the buffer to be killed. */) else mp = &m->next; } + /* Intervals should be owned by the base buffer (Bug#16502). */ + i = buffer_intervals (b); + if (i) + { + Lisp_Object owner; + XSETBUFFER (owner, b->base_buffer); + set_interval_object (i, owner); + } } else { diff --git a/src/intervals.c b/src/intervals.c index 13ff9a9e3db..703c0cefbd5 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -60,16 +60,7 @@ static INTERVAL reproduce_tree (INTERVAL, INTERVAL); /* Utility functions for intervals. */ -/* Use these functions to set Lisp_Object - or pointer slots of struct interval. */ - -static void -set_interval_object (INTERVAL i, Lisp_Object obj) -{ - eassert (BUFFERP (obj) || STRINGP (obj)); - i->up_obj = 1; - i->up.obj = obj; -} +/* Use these functions to set pointer slots of struct interval. */ static void set_interval_left (INTERVAL i, INTERVAL left) diff --git a/src/intervals.h b/src/intervals.h index 45c2e5f5e54..e901f99747d 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -133,6 +133,14 @@ struct interval /* Use these functions to set Lisp_Object or pointer slots of struct interval. */ +INLINE void +set_interval_object (INTERVAL i, Lisp_Object obj) +{ + eassert (BUFFERP (obj) || STRINGP (obj)); + i->up_obj = 1; + i->up.obj = obj; +} + INLINE void set_interval_parent (INTERVAL i, INTERVAL parent) {