Re: Patch - Fix for cross thread instantation when using wrap base.

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Wed, Apr 07, 2010 at 04:43:03AM +1200, Nigel Atkinson wrote:
> I've been bug squishing.  This one was a bit curly to track down, given
> the symptoms.  I've included a test program that breaks without the
> patch, and I've tested the fix in a larger program that uses luabind
> extensively.
> 
> The test program seg-faults when trying to call the method, even with
> the thread that made the Lua class still around - which I initially
> thought was the problem, but it wasn't.  The bug only seems to show
> itself, when using wrap_base and Lua overload-able class methods.
> 
> The first patch is some minor cleaning that I noticed while stepping
> through the code.

Thanks, I've pushed this to the 0.9 branch.

> The second is the bug fix.

Thanks for figuring this out.

I'm wondering if it wouldn't be simpler and more efficient to add a
constructor to weak_ref et al. that takes the lua_State* of the main
thread. That would avoid doing all this stack moving and get rid of the
two extra API calls. Thoughts?

> PS What's the preferred patch format?  I used git format-patch this
> time.  Does that make things easier?

Yeah, it makes things easier because I can just use "git am" and get the
commit message and author correct right away.

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.