*fixed an invalid gc table iteration bug.

This commit is contained in:
paladin-t 2016-01-15 12:49:02 +08:00
parent 8e3a9ab748
commit 86e79c059d
3 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,7 @@
Jan. 15 2016 Jan. 15 2016
Fixed some crash bugs with invalid syntax Fixed some crash bugs with invalid syntax
Fixed some memory leak with invalid syntax Fixed some memory leak with invalid syntax
Fixed an invalid GC table iteration bug
Jan. 14 2016 Jan. 14 2016
Fixed a collection accessing bug in an assignment statement Fixed a collection accessing bug in an assignment statement

View File

@ -4670,12 +4670,18 @@ void _gc_add(_ref_t* ref, void* data, _gc_t* gc) {
void _gc_remove(_ref_t* ref, void* data) { void _gc_remove(_ref_t* ref, void* data) {
/* Remove a referenced object from GC */ /* Remove a referenced object from GC */
_ht_node_t* table = 0;
mb_unrefvar(data); mb_unrefvar(data);
mb_assert(ref && data); mb_assert(ref && data);
if(ref->s->gc.table) if(ref->s->gc.collecting)
_ht_remove(ref->s->gc.table, ref, 0); table = ref->s->gc.recursive_table;
else
table = ref->s->gc.table;
if(table)
_ht_remove(table, ref, 0);
} }
int _gc_add_reachable(void* data, void* extra, void* ht) { int _gc_add_reachable(void* data, void* extra, void* ht) {

Binary file not shown.