[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: LuaJIT2 crashes with luabind or wxLua
- From: Daniel Wallin <daniel@...>
- Date: Fri, 16 Apr 2010 10:44:04 +0200
On Thu, Apr 15, 2010 at 09:20:23PM +0200, Mike Pall wrote:
> Daniel Wallin wrote:
> > On Thu, Apr 15, 2010 at 02:17:23PM +0200, Mike Pall wrote:
> > > It could be that luabind tries to throw exceptions across Lua
> > > frames or tries to throw Lua errors across C++ frames protected
> > > with try/catch (works on Windows/x64, crashes on Windows/x86).
> > It doesn't. In this case static_class_gettable() calls lua_error()
> > directly, with no non-trivial objects alive on the stack, so it should
> > be longjmp-safe. lua_pcall() returns properly, and then the crash
> > happens when luabind throws an exception.
> As far as I can see from the comments in the code, the first error
> (for the invalid member) works, only the second error (for the
> invalid static member) ought to cause a crash on Windows/x86 (do
> you see this, too?).
> That's remarkable, because the only difference is from where the
> original error is thrown. Either from lj_meta_call() (for the call
> of a nil value) or in static_class_gettable() -- but both end up
> in the exact same code path. And your analysis indicates that it
> crashes later on the rethrow. Maybe this is order-sensitive? Maybe
> the free list of the memory allocator got corrupted?
Here's a much simplified test:
int throw_error(lua_State* L)
dummy += "foo";
lua_State* L = lua_open();
lua_pushcclosure(L, &throw_error, 0);
The key is the std::string object in throw_error(). Without that
everything works fine, with it present the throw crashes. Any ideas?