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 878844dd020..1f18dbd11a8 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4516,23 +4516,6 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4516 | Lisp_Object *copy; | 4516 | Lisp_Object *copy; |
| 4517 | ptrdiff_t i; | 4517 | ptrdiff_t i; |
| 4518 | 4518 | ||
| 4519 | if (size) | ||
| 4520 | { | ||
| 4521 | Lisp_Object ovl | ||
| 4522 | = XVECTOR (last_overlay_modification_hooks)->contents[1]; | ||
| 4523 | |||
| 4524 | /* If the buffer of the first overlay in the array doesn't | ||
| 4525 | match the current buffer, then these modification hooks | ||
| 4526 | should not be run in this buffer. This could happen when | ||
| 4527 | some code calls some insdel functions, such as del_range_1, | ||
| 4528 | with the PREPARE argument false -- in that case this | ||
| 4529 | function is never called to record the overlay modification | ||
| 4530 | hook functions in the last_overlay_modification_hooks | ||
| 4531 | array, so anything we find there is not ours. */ | ||
| 4532 | if (XMARKER (OVERLAY_START (ovl))->buffer != current_buffer) | ||
| 4533 | return; | ||
| 4534 | } | ||
| 4535 | |||
| 4536 | USE_SAFE_ALLOCA; | 4519 | USE_SAFE_ALLOCA; |
| 4537 | SAFE_ALLOCA_LISP (copy, size); | 4520 | SAFE_ALLOCA_LISP (copy, size); |
| 4538 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, | 4521 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |
| @@ -4543,7 +4526,12 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after, | |||
| 4543 | Lisp_Object prop_i, overlay_i; | 4526 | Lisp_Object prop_i, overlay_i; |
| 4544 | prop_i = copy[i++]; | 4527 | prop_i = copy[i++]; |
| 4545 | overlay_i = copy[i++]; | 4528 | overlay_i = copy[i++]; |
| 4546 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); | 4529 | /* It is possible that the recorded overlay has been deleted |
| 4530 | (which makes it's markers' buffers be nil), or that (due to | ||
| 4531 | some bug) it belongs to a different buffer. Only run this | ||
| 4532 | hook if the overlay belongs to the current buffer. */ | ||
| 4533 | if (XMARKER (OVERLAY_START (overlay_i))->buffer == current_buffer) | ||
| 4534 | call_overlay_mod_hooks (prop_i, overlay_i, after, arg1, arg2, arg3); | ||
| 4547 | } | 4535 | } |
| 4548 | 4536 | ||
| 4549 | SAFE_FREE (); | 4537 | SAFE_FREE (); |