Re: [code] [textadept] LexerLPeg's references to Scintilla?

From: Mitchell <m.att.foicica.com>
Date: Fri, 6 Sep 2013 23:11:01 -0400 (EDT)

Hi Chris,

On Fri, 6 Sep 2013, Chris Emerson wrote:

> Hi,
>
> I have a repeatable crash in my modified textadept where I've implemented
> split views for curses (https://bitbucket.org/jugglerchris/textadept/).
> It's almost certainly something I'm doing wrong!
>
> The sequence to reproduce (on my modified textadept-curses) are:
>
> 1. textadept-curses init.lua -- any file which triggers a lexer, I think
> 2. view:split()
> 3. gui.goto_view(1) -- switch to the other view
> 4. view:unsplit() -- back to one view
> 5. view:split() -- bang!
>
> The immediate cause is that something's happening to a LexerLPeg object which
> has a reference to the Scintilla object deleted in step 4 above. The top of
> the callstack is as follows (after that are quite a lot of Lua frames):

I've seen this before[1]. When the Scintilla object held by LexerLPeg is
deleted, you have to update the reference to an existing one using the
`private_lexer_call(SETDIRECTPOINTER, buffer.direct_pointer)` Scintillua
API. You just have to add the same line in the referenced changeset to the
`VIEW_AFTER_SWITCH` event too in `core/gui.lua`.

As far as a Lua stack trace from gdb, I don't know how it's done.
Debugging Lua is really tough :( I had to use `print()` statements in the
event emission code to determine if the above fix was valid.

What you are doing is awesome!

Cheers,
Mitchell

[1]: http://foicica.com/hg/textadept/rev/fb916ac421ec

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 06 Sep 2013 - 23:11:01 EDT

This archive was generated by hypermail 2.2.0 : Sat 07 Sep 2013 - 06:54:50 EDT