diff options
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/buffer.c b/src/buffer.c index b0cee717036..179360c5622 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4543,23 +4543,6 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4543 | Lisp_Object *copy; | 4543 | Lisp_Object *copy; |
| 4544 | ptrdiff_t i; | 4544 | ptrdiff_t i; |
| 4545 | 4545 | ||
| 4546 | if (size) | ||
| 4547 | { | ||
| 4548 | Lisp_Object ovl | ||
| 4549 | = XVECTOR (last_overlay_modification_hooks)->contents[1]; | ||
| 4550 | |||
| 4551 | /* If the buffer of the first overlay in the array doesn't | ||
| 4552 | match the current buffer, then these modification hooks | ||
| 4553 | should not be run in this buffer. This could happen when | ||
| 4554 | some code calls some insdel functions, such as del_range_1, | ||
| 4555 | with the PREPARE argument false -- in that case this | ||
| 4556 | function is never called to record the overlay modification | ||
| 4557 | hook functions in the last_overlay_modification_hooks | ||
| 4558 | array, so anything we find there is not ours. */ | ||
| 4559 | if (XMARKER (OVERLAY_START (ovl))->buffer != current_buffer) | ||
| 4560 | return; | ||
| 4561 | } | ||
| 4562 | |||
| 4563 | USE_SAFE_ALLOCA; | 4546 | USE_SAFE_ALLOCA; |
| 4564 | SAFE_ALLOCA_LISP (copy, size); | 4547 | SAFE_ALLOCA_LISP (copy, size); |
| 4565 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, | 4548 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |
| @@ -4570,7 +4553,12 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4570 | Lisp_Object prop_i, overlay_i; | 4553 | Lisp_Object prop_i, overlay_i; |
| 4571 | prop_i = copy[i++]; | 4554 | prop_i = copy[i++]; |
| 4572 | overlay_i = copy[i++]; | 4555 | overlay_i = copy[i++]; |
| 4573 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); | 4556 | /* It is possible that the recorded overlay has been deleted |
| 4557 | (which makes it's markers' buffers be nil), or that (due to | ||
| 4558 | some bug) it belongs to a different buffer. Only run this | ||
| 4559 | hook if the overlay belongs to the current buffer. */ | ||
| 4560 | if (XMARKER (OVERLAY_START (overlay_i))->buffer == current_buffer) | ||
| 4561 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); | ||
| 4574 | } | 4562 | } |
| 4575 | 4563 | ||
| 4576 | SAFE_FREE (); | 4564 | SAFE_FREE (); |