diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-03 09:48:25 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2010-12-03 09:48:25 -0200 |
commit | 350cc4bcb67e652fafbc9ef591bb79333703abee (patch) | |
tree | c426246bd451890d23f1c185d300e4465475d60c | |
parent | 35931bbed4b47a450330ed02fe7758543d410836 (diff) | |
download | lua-350cc4bcb67e652fafbc9ef591bb79333703abee.tar.gz lua-350cc4bcb67e652fafbc9ef591bb79333703abee.tar.bz2 lua-350cc4bcb67e652fafbc9ef591bb79333703abee.zip |
'micro' bug: when closing state, old objects are finalized (breaking
assertion)
-rw-r--r-- | lgc.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.104 2010/11/18 19:15:00 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.104 2010/11/26 14:32:31 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -689,12 +689,11 @@ static void checkSizes (lua_State *L) { | |||
689 | static GCObject *udata2finalize (global_State *g) { | 689 | static GCObject *udata2finalize (global_State *g) { |
690 | GCObject *o = g->tobefnz; /* get first element */ | 690 | GCObject *o = g->tobefnz; /* get first element */ |
691 | lua_assert(isfinalized(o)); | 691 | lua_assert(isfinalized(o)); |
692 | lua_assert(!isold(o)); | ||
693 | g->tobefnz = gch(o)->next; /* remove it from 'tobefnz' list */ | 692 | g->tobefnz = gch(o)->next; /* remove it from 'tobefnz' list */ |
694 | gch(o)->next = g->allgc; /* return it to 'allgc' list */ | 693 | gch(o)->next = g->allgc; /* return it to 'allgc' list */ |
695 | g->allgc = o; | 694 | g->allgc = o; |
696 | resetbit(gch(o)->marked, SEPARATED); /* mark that it is not in 'tobefnz' */ | 695 | resetbit(gch(o)->marked, SEPARATED); /* mark that it is not in 'tobefnz' */ |
697 | resetoldbit(o); /* see MOVE OLD rule */ | 696 | lua_assert(!isold(o)); /* see MOVE OLD rule */ |
698 | if (!keepinvariant(g)) /* not keeping invariant? */ | 697 | if (!keepinvariant(g)) /* not keeping invariant? */ |
699 | makewhite(g, o); /* "sweep" object */ | 698 | makewhite(g, o); /* "sweep" object */ |
700 | return o; | 699 | return o; |
@@ -823,10 +822,14 @@ void luaC_changemode (lua_State *L, int mode) { | |||
823 | 822 | ||
824 | 823 | ||
825 | /* | 824 | /* |
826 | ** call all pending finalizers */ | 825 | ** call all pending finalizers |
826 | */ | ||
827 | static void callallpendingfinalizers (lua_State *L, int propagateerrors) { | 827 | static void callallpendingfinalizers (lua_State *L, int propagateerrors) { |
828 | global_State *g = G(L); | 828 | global_State *g = G(L); |
829 | while (g->tobefnz) GCTM(L, propagateerrors); | 829 | while (g->tobefnz) { |
830 | resetoldbit(g->tobefnz); | ||
831 | GCTM(L, propagateerrors); | ||
832 | } | ||
830 | } | 833 | } |
831 | 834 | ||
832 | 835 | ||