diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-10-03 09:36:46 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2012-10-03 09:36:46 -0300 |
commit | 86b39206d998a184a105bfb63b630ed28e1c81bc (patch) | |
tree | 8d4cad30114addb437265532007e3b40db10eebd /lfunc.c | |
parent | fdae4b9453fa7432f5b1a88c55dca33f1c861263 (diff) | |
download | lua-86b39206d998a184a105bfb63b630ed28e1c81bc.tar.gz lua-86b39206d998a184a105bfb63b630ed28e1c81bc.tar.bz2 lua-86b39206d998a184a105bfb63b630ed28e1c81bc.zip |
open upvalues cannot be old if thread is not old; when thread is old,
their list is not traversed anymore, and therefore can contain dead
elements.
Diffstat (limited to '')
-rw-r--r-- | lfunc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lfunc.c,v 2.28 2012/01/20 22:05:50 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 2.29 2012/05/08 13:53:33 roberto Exp roberto $ |
3 | ** Auxiliary functions to manipulate prototypes and closures | 3 | ** Auxiliary functions to manipulate prototypes and closures |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -52,12 +52,12 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { | |||
52 | while (*pp != NULL && (p = gco2uv(*pp))->v >= level) { | 52 | while (*pp != NULL && (p = gco2uv(*pp))->v >= level) { |
53 | GCObject *o = obj2gco(p); | 53 | GCObject *o = obj2gco(p); |
54 | lua_assert(p->v != &p->u.value); | 54 | lua_assert(p->v != &p->u.value); |
55 | lua_assert(!isold(o) || isold(obj2gco(L))); | ||
55 | if (p->v == level) { /* found a corresponding upvalue? */ | 56 | if (p->v == level) { /* found a corresponding upvalue? */ |
56 | if (isdead(g, o)) /* is it dead? */ | 57 | if (isdead(g, o)) /* is it dead? */ |
57 | changewhite(o); /* resurrect it */ | 58 | changewhite(o); /* resurrect it */ |
58 | return p; | 59 | return p; |
59 | } | 60 | } |
60 | resetoldbit(o); /* may create a newer upval after this one */ | ||
61 | pp = &p->next; | 61 | pp = &p->next; |
62 | } | 62 | } |
63 | /* not found: create a new one */ | 63 | /* not found: create a new one */ |