mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
bugfix, See issue #1027
This commit is contained in:
@@ -155,6 +155,7 @@ void luaF_shareproto (Proto *f) {
|
||||
int i;
|
||||
if (f == NULL)
|
||||
return;
|
||||
makeshared(f);
|
||||
MAKESHARED(f->source);
|
||||
for (i = 0; i < f->sizek; i++) {
|
||||
if (ttnov(&f->k[i]) == LUA_TSTRING)
|
||||
|
||||
@@ -266,8 +266,10 @@ static void reallymarkobject (global_State *g, GCObject *o) {
|
||||
break;
|
||||
}
|
||||
case LUA_TLCL: {
|
||||
white2gray(o);
|
||||
linkgclist(gco2lcl(o), g->gray);
|
||||
if (!isshared(o)) {
|
||||
white2gray(o);
|
||||
linkgclist(gco2lcl(o), g->gray);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LUA_TCCL: {
|
||||
|
||||
@@ -935,6 +935,7 @@ new_string(unsigned int h, const char *str, lu_byte l) {
|
||||
memset(ts, 0, sz);
|
||||
setbits(ts->marked, WHITEBITS);
|
||||
gray2black(ts);
|
||||
makeshared(ts);
|
||||
ts->tt = LUA_TSHRSTR;
|
||||
ts->hash = h;
|
||||
ts->shrlen = l;
|
||||
|
||||
@@ -39,8 +39,12 @@ mark_shared(lua_State *L) {
|
||||
case LUA_TLIGHTUSERDATA:
|
||||
break;
|
||||
case LUA_TFUNCTION:
|
||||
if (!lua_iscfunction(L, idx) || lua_getupvalue(L, idx, 1) != NULL)
|
||||
luaL_error(L, "Invalid function");
|
||||
if (lua_getupvalue(L, idx, 1) != NULL) {
|
||||
luaL_error(L, "Invalid function with upvalue");
|
||||
} else if (!lua_iscfunction(L, idx)) {
|
||||
LClosure *f = (LClosure *)lua_topointer(L, idx);
|
||||
makeshared(f);
|
||||
}
|
||||
break;
|
||||
case LUA_TSTRING:
|
||||
lua_sharestring(L, idx);
|
||||
|
||||
Reference in New Issue
Block a user