[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115138: Fix bug #15841 with assertion violations du
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] trunk r115138: Fix bug #15841 with assertion violations due to newline cache. |
Date: |
Mon, 18 Nov 2013 16:31:03 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115138
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15841
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Mon 2013-11-18 18:29:49 +0200
message:
Fix bug #15841 with assertion violations due to newline cache.
src/insdel.c (invalidate_buffer_caches): New function, consolidated
from part of prepare_to_modify_buffer.
(insert_from_gap, prepare_to_modify_buffer):
src/coding.c (code_convert_region, code_convert_string): Call
invalidate_buffer_caches.
src/lisp.h (invalidate_buffer_caches): Add prototype.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/coding.c coding.c-20091113204419-o5vbwnq5f7feedwu-1077
src/insdel.c insdel.c-20091113204419-o5vbwnq5f7feedwu-175
src/lisp.h lisp.h-20091113204419-o5vbwnq5f7feedwu-253
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-11-17 21:02:09 +0000
+++ b/src/ChangeLog 2013-11-18 16:29:49 +0000
@@ -1,3 +1,13 @@
+2013-11-18 Eli Zaretskii <address@hidden>
+
+ * insdel.c (invalidate_buffer_caches): New function, consolidated
+ from part of prepare_to_modify_buffer.
+ (insert_from_gap, prepare_to_modify_buffer):
+ * coding.c (code_convert_region, code_convert_string): Call
+ invalidate_buffer_caches. (Bug#15841)
+
+ * lisp.h (invalidate_buffer_caches): Add prototype.
+
2013-11-17 Eli Zaretskii <address@hidden>
* w32term.c (x_update_window_end): Don't invalidate the entire
=== modified file 'src/coding.c'
--- a/src/coding.c 2013-10-08 06:40:09 +0000
+++ b/src/coding.c 2013-11-18 16:29:49 +0000
@@ -9358,6 +9358,14 @@
setup_coding_system (coding_system, &coding);
coding.mode |= CODING_MODE_LAST_BLOCK;
+ if (BUFFERP (dst_object) && !EQ (dst_object, src_object))
+ {
+ struct buffer *buf = XBUFFER (dst_object);
+ ptrdiff_t buf_pt = BUF_PT (buf);
+
+ invalidate_buffer_caches (buf, buf_pt, buf_pt);
+ }
+
if (encodep)
encode_coding_object (&coding, src_object, from, from_byte, to, to_byte,
dst_object);
@@ -9447,6 +9455,15 @@
coding.mode |= CODING_MODE_LAST_BLOCK;
chars = SCHARS (string);
bytes = SBYTES (string);
+
+ if (BUFFERP (dst_object))
+ {
+ struct buffer *buf = XBUFFER (dst_object);
+ ptrdiff_t buf_pt = BUF_PT (buf);
+
+ invalidate_buffer_caches (buf, buf_pt, buf_pt);
+ }
+
if (encodep)
encode_coding_object (&coding, string, 0, 0, chars, bytes, dst_object);
else
=== modified file 'src/insdel.c'
--- a/src/insdel.c 2013-11-11 05:18:53 +0000
+++ b/src/insdel.c 2013-11-18 16:29:49 +0000
@@ -993,6 +993,11 @@
if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
nchars = nbytes;
+ /* No need to call prepare_to_modify_buffer, since this is called
+ from places that replace some region with a different text, so
+ prepare_to_modify_buffer was already called by the deletion part
+ of this dance. */
+ invalidate_buffer_caches (current_buffer, GPT, GPT);
record_insert (GPT, nchars);
MODIFF++;
@@ -1869,19 +1874,26 @@
ptrdiff_t *preserve_ptr)
{
prepare_to_modify_buffer_1 (start, end, preserve_ptr);
+ invalidate_buffer_caches (current_buffer, start, end);
+}
- if (current_buffer->newline_cache)
- invalidate_region_cache (current_buffer,
- current_buffer->newline_cache,
- start - BEG, Z - end);
- if (current_buffer->width_run_cache)
- invalidate_region_cache (current_buffer,
- current_buffer->width_run_cache,
- start - BEG, Z - end);
- if (current_buffer->bidi_paragraph_cache)
- invalidate_region_cache (current_buffer,
- current_buffer->bidi_paragraph_cache,
- start - BEG, Z - end);
+/* Invalidate the caches maintained by the buffer BUF, if any, for the
+ region between buffer positions START and END. */
+void
+invalidate_buffer_caches (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
+{
+ if (buf->newline_cache)
+ invalidate_region_cache (buf,
+ buf->newline_cache,
+ start - BUF_BEG (buf), BUF_Z (buf) - end);
+ if (buf->width_run_cache)
+ invalidate_region_cache (buf,
+ buf->width_run_cache,
+ start - BUF_BEG (buf), BUF_Z (buf) - end);
+ if (buf->bidi_paragraph_cache)
+ invalidate_region_cache (buf,
+ buf->bidi_paragraph_cache,
+ start - BUF_BEG (buf), BUF_Z (buf) - end);
}
/* These macros work with an argument named `preserve_ptr'
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2013-11-17 03:58:30 +0000
+++ b/src/lisp.h 2013-11-18 16:29:49 +0000
@@ -3479,6 +3479,7 @@
extern void modify_text (ptrdiff_t, ptrdiff_t);
extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
extern void prepare_to_modify_buffer_1 (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
+extern void invalidate_buffer_caches (struct buffer *, ptrdiff_t, ptrdiff_t);
extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t);
extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t,
ptrdiff_t, ptrdiff_t);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115138: Fix bug #15841 with assertion violations due to newline cache.,
Eli Zaretskii <=