diff options
| author | Eli Zaretskii | 2015-11-06 17:19:39 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-11-06 17:19:39 +0200 |
| commit | 564d811725596f15ecf543777e11504b47d2af86 (patch) | |
| tree | 5d2569aedec23e0dc68c2c3c03d3277bbade0134 /src/buffer.c | |
| parent | 3172a6ac39d98383451e8b36cd33d291347fc93b (diff) | |
| download | emacs-564d811725596f15ecf543777e11504b47d2af86.tar.gz emacs-564d811725596f15ecf543777e11504b47d2af86.zip | |
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)
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c index 91e42dca2bf..c0179c7584e 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4481,6 +4481,23 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4481 | Lisp_Object *copy; | 4481 | Lisp_Object *copy; |
| 4482 | ptrdiff_t i; | 4482 | ptrdiff_t i; |
| 4483 | 4483 | ||
| 4484 | if (size) | ||
| 4485 | { | ||
| 4486 | Lisp_Object ovl | ||
| 4487 | = XVECTOR (last_overlay_modification_hooks)->contents[1]; | ||
| 4488 | |||
| 4489 | /* If the buffer of the first overlay in the array doesn't | ||
| 4490 | match the current buffer, then these modification hooks | ||
| 4491 | should not be run in this buffer. This could happen when | ||
| 4492 | some code calls some insdel functions, such as del_range_1, | ||
| 4493 | with the PREPARE argument false -- in that case this | ||
| 4494 | function is never called to record the overlay modification | ||
| 4495 | hook functions in the last_overlay_modification_hooks | ||
| 4496 | array, so anything we find there is not ours. */ | ||
| 4497 | if (XMARKER (OVERLAY_START (ovl))->buffer != current_buffer) | ||
| 4498 | return; | ||
| 4499 | } | ||
| 4500 | |||
| 4484 | USE_SAFE_ALLOCA; | 4501 | USE_SAFE_ALLOCA; |
| 4485 | SAFE_ALLOCA_LISP (copy, size); | 4502 | SAFE_ALLOCA_LISP (copy, size); |
| 4486 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, | 4503 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |