aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog7
-rw-r--r--src/buffer.c9
-rw-r--r--src/intervals.c11
-rw-r--r--src/intervals.h8
4 files changed, 25 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ac7624ee4ab..99a3e7e7299 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12014-01-21 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * buffer.c (Fkill_buffer): When killing an indirect buffer,
4 re-attach intervals to its base buffer (Bug#16502).
5 * intervals.c (set_interval_object): Move from here...
6 * intervals.h (set_interval_object): ... to here. Fix comments.
7
12014-01-20 Paul Eggert <eggert@cs.ucla.edu> 82014-01-20 Paul Eggert <eggert@cs.ucla.edu>
2 9
3 Avoid undefined behavior by initializing buffer redisplay bit. 10 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. */)
1868 1868
1869 if (b->base_buffer) 1869 if (b->base_buffer)
1870 { 1870 {
1871 INTERVAL i;
1871 /* Unchain all markers that belong to this indirect buffer. 1872 /* Unchain all markers that belong to this indirect buffer.
1872 Don't unchain the markers that belong to the base buffer 1873 Don't unchain the markers that belong to the base buffer
1873 or its other indirect buffers. */ 1874 or its other indirect buffers. */
@@ -1882,6 +1883,14 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1882 else 1883 else
1883 mp = &m->next; 1884 mp = &m->next;
1884 } 1885 }
1886 /* Intervals should be owned by the base buffer (Bug#16502). */
1887 i = buffer_intervals (b);
1888 if (i)
1889 {
1890 Lisp_Object owner;
1891 XSETBUFFER (owner, b->base_buffer);
1892 set_interval_object (i, owner);
1893 }
1885 } 1894 }
1886 else 1895 else
1887 { 1896 {
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);
60 60
61/* Utility functions for intervals. */ 61/* Utility functions for intervals. */
62 62
63/* Use these functions to set Lisp_Object 63/* Use these functions to set pointer slots of struct interval. */
64 or pointer slots of struct interval. */
65
66static void
67set_interval_object (INTERVAL i, Lisp_Object obj)
68{
69 eassert (BUFFERP (obj) || STRINGP (obj));
70 i->up_obj = 1;
71 i->up.obj = obj;
72}
73 64
74static void 65static void
75set_interval_left (INTERVAL i, INTERVAL left) 66set_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
@@ -134,6 +134,14 @@ struct interval
134 or pointer slots of struct interval. */ 134 or pointer slots of struct interval. */
135 135
136INLINE void 136INLINE void
137set_interval_object (INTERVAL i, Lisp_Object obj)
138{
139 eassert (BUFFERP (obj) || STRINGP (obj));
140 i->up_obj = 1;
141 i->up.obj = obj;
142}
143
144INLINE void
137set_interval_parent (INTERVAL i, INTERVAL parent) 145set_interval_parent (INTERVAL i, INTERVAL parent)
138{ 146{
139 i->up_obj = false; 147 i->up_obj = false;