lua-users home
lua-l archive

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


Yep, I see it now, lua_newthread relies on CommonHeader being the very first unit of lua_State structure. Sorry for the spam.

AB

-----Original Message-----
From: Bilyk, Alex 
Sent: Thursday, January 30, 2003 9:57 AM
To: Multiple recipients of list
Subject: RE: is this a bug in lua core 5.0b ?

Curiously enough, I am calling coroutine.create via a lua_call or lua_pcall and either end up with memory corruption that prevents further scripts execution with message "error in error handling" or a simple crash in GC. lua_[p]call itself executes with no problems taking 1 parameter and returning a new coroutine/lua_State* on the stack. But after this things go berserk.

In my test run pState == pMainState (see code below). Call to lua_pcall succeeds leaving a new lua_State* on the stack. Using lua_call instead of lua_pcall makes no difference. I don't override Lua's memory allocation facilities. Commenting out lua_pcall fixes the problem. I did add one more member variable (void* mpMyData) to lua_State structure that I placed before CommonHeader. So, this variable can technically be a problem, I suspect.
[chop-chop]