Re: [code] [textadept] Possible bug?

From: Mitchell <m.att.foicica.com>
Date: Thu, 10 May 2018 19:02:45 -0400 (EDT)

Hi James,

On Thu, 10 May 2018, triplejam wrote:

> Hi again, I've just discovered a way to get it to stop from crashing. But I don't really understand exactly why it works. All I had to do was move the l_setcfunction function calls in spell(lua_State *L) in the lspell.cxx file to outside of the conditional so it looks like this:
>
> if(luaL_newmetatable(L, "ta_spell")) {}
> l_setcfunction(L, -1, "add_dic", ls_adddic);
> l_setcfunction(L, -1, "spell", ls_spell);
> l_setcfunction(L, -1, "suggest", ls_suggest);
> l_setcfunction(L, -1, "add_word", ls_addword);
> lua_pushvalue(L, -1), lua_setfield(L, -2, "__index");
>
> The only hint to why it was crashing was that gdb warning message, into which I looked a bit further. I discovered that the ?? might be refering to somewhere the shared library was located in memory before the reset(). I compared the output in gdb of 'info proc all' before a reset() and after a crash(can send a pic or text file comparing if you want). Based on it, I think sometimes, a pointer doesn't get changed to the new location, so it segfaults when trying to access the old location.

Wow, nice sleuthing. I learned something new. Please try compiling the fix I just committed[1] when you have the chance.

Cheers,
Mitchell

[1]: https://foicica.com/hg/spellcheck/rev/42aa0393f046

-- 
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 Thu 10 May 2018 - 19:02:45 EDT

This archive was generated by hypermail 2.2.0 : Fri 11 May 2018 - 06:25:48 EDT