bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#21819: 24.5; Overlay modification function called with wrong argumen


From: Yutian Li | 李雨田
Subject: bug#21819: 24.5; Overlay modification function called with wrong arguments
Date: Tue, 3 Nov 2015 00:24:41 -0800

Hi.

This happens on both Mac and GNU/Linux with latest release of Emacs. I
also tried the master branch of `git://git.sv.gnu.org/emacs.git` and
it still exists.

The discussion that led to the discovery of the bug is
[here](https://github.com/capitaomorte/yasnippet/issues/607). There is
a stack trace on the OP. Some guesses in the bottom. There is also
instructions to reproduce this.

The direct cause is the modification hook registered with the overlay
is called with apparently wrong arguments. The hook function is
registered with an overlay in the C++ buffer, but called with `beg`
and `end` referring to positions probably in the `*Messages*` buffer.
As the stack trace shows, Flycheck called `message` to display a
message indicating syntax errors, and `message` somehow invokes the
modification hook function, which was defined in C++ buffer but called
now in `*Messages*` buffer.

I traced into the Emacs source file `src/buffer.c`.  There is a
function `report_overlay_modification`. It *should* (I guess) be
called with `after` set to `false` and `true` alternatively. But on
the erroneous invocation, it is called with `after` set to `true`
twice consecutively. The first call `_beg` and `_end` are normal small
integer (inside C++ buffer). The second call they are huge and must
refer to the `*Messages*` buffer. Inside the call, it uses a global
array to store overlay modification hook functions. Now it's called
twice consecutively with `after` set to `true`, it must have reused
old hook functions, hence the call to our function with correct
overlay but wrong cursor. Because on a call with `after` set to
`false`, it will "clear" the hook functions.

Best regards,
Yutian LI | 李雨田

Mobile: +1 (650) 798-9092
E-mail: hotpxless@gmail.com

Computer Science Department
Stanford University





reply via email to

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