diff options
-rw-r--r-- | lstate.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.123 2014/07/18 13:36:14 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.124 2014/07/24 14:00:16 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -250,7 +250,7 @@ static void close_state (lua_State *L) { | |||
250 | 250 | ||
251 | 251 | ||
252 | LUA_API lua_State *lua_newthread (lua_State *L) { | 252 | LUA_API lua_State *lua_newthread (lua_State *L) { |
253 | global_State *g = G(L); | 253 | global_State *g = G(L); |
254 | lua_State *L1; | 254 | lua_State *L1; |
255 | lua_lock(L); | 255 | lua_lock(L); |
256 | luaC_checkGC(L); | 256 | luaC_checkGC(L); |
@@ -270,7 +270,8 @@ LUA_API lua_State *lua_newthread (lua_State *L) { | |||
270 | L1->hook = L->hook; | 270 | L1->hook = L->hook; |
271 | resethookcount(L1); | 271 | resethookcount(L1); |
272 | /* initialize L1 extra space */ | 272 | /* initialize L1 extra space */ |
273 | memcpy(lua_getextraspace(L1), lua_getextraspace(L), LUA_EXTRASPACE); | 273 | memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), |
274 | LUA_EXTRASPACE); | ||
274 | luai_userstatethread(L, L1); | 275 | luai_userstatethread(L, L1); |
275 | stack_init(L1, L); /* init stack */ | 276 | stack_init(L1, L); /* init stack */ |
276 | lua_unlock(L); | 277 | lua_unlock(L); |