[Top][All Lists]

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

Re: Calling Lisp from undo.c's record_* functions

From: Phillip Lord
Subject: Re: Calling Lisp from undo.c's record_* functions
Date: Tue, 17 Nov 2015 12:14:27 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> Debugging uncovered the following sequence of calls:
>>   . bottom line: the gap was shrunk behind the back of
>>     insert_from_string_1, which totally doesn't expect that, and
>>     proceeds doing silly things, like setting the gap size to a large
>>     negative value, and from there we are on a certain and very short
>>     path to a crash
> Duh!
>> My dilemma is: how to fix this cleanly and correctly?
> Not sure what's the best solution, but the precise moment when
> run_undoable_change is executed is not terribly important, so if we
> could just move it to either before or after the "critical section",
> then that would be a good solution.

I'm not sure how I would identify the "critical section".

At one point, this function call was actually a hook
(after-undoable-change-hook). Would this solve the problem?

>> Question #1: do we really need to call Lisp from so deep inside the
>> bowels of buffer manipulation routines?  Is that safe?  Perhaps we
>> should reimplement undo-auto--undoable-change inC?
> That should work, yes.

I've pushed an unfinished fix to fix/segfault-from-run-undoable-change

I'm pretty sure my implementation in C could be simpler. I wasn't sure
how to get from the current-buffer variable in C, to the Lisp_Object, so
in the end, I just called Fcurrent_buffer.

The second part of the plan is to change simple.el to use a idle timer,
as I suggested yesterday. I'll do that later today.

At the moment, I can't replicate the problem, though.


reply via email to

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