emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 564d811: Don't invoke overlay modification hooks in


From: Eli Zaretskii
Subject: [Emacs-diffs] master 564d811: Don't invoke overlay modification hooks in wrong buffer
Date: Fri, 06 Nov 2015 15:21:14 +0000

branch: master
commit 564d811725596f15ecf543777e11504b47d2af86
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Don't invoke overlay modification hooks in wrong buffer
    
    * src/buffer.c (report_overlay_modification): When called with
    AFTER non-zero, don't invoke overlay modification hooks if the
    buffer recorded in last_overlay_modification_hooks is different
    from the current buffer.  (Bug#21824)
---
 src/buffer.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/buffer.c b/src/buffer.c
index 91e42dc..c0179c7 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4481,6 +4481,23 @@ report_overlay_modification (Lisp_Object start, 
Lisp_Object end, bool after,
     Lisp_Object *copy;
     ptrdiff_t i;
 
+    if (size)
+      {
+       Lisp_Object ovl
+         = XVECTOR (last_overlay_modification_hooks)->contents[1];
+
+       /* If the buffer of the first overlay in the array doesn't
+          match the current buffer, then these modification hooks
+          should not be run in this buffer.  This could happen when
+          some code calls some insdel functions, such as del_range_1,
+          with the PREPARE argument false -- in that case this
+          function is never called to record the overlay modification
+          hook functions in the last_overlay_modification_hooks
+          array, so anything we find there is not ours.  */
+       if (XMARKER (OVERLAY_START (ovl))->buffer != current_buffer)
+         return;
+      }
+
     USE_SAFE_ALLOCA;
     SAFE_ALLOCA_LISP (copy, size);
     memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]