*fixed a class gc bug.
This commit is contained in:
parent
5195a472ad
commit
6ba1d3cb54
3
HISTORY
3
HISTORY
@ -1,3 +1,6 @@
|
|||||||
|
Dec. 21 2015
|
||||||
|
Fixed a class GC bug
|
||||||
|
|
||||||
Dec. 19 2015
|
Dec. 19 2015
|
||||||
Improved error handling when defining a class in C
|
Improved error handling when defining a class in C
|
||||||
|
|
||||||
|
@ -4482,10 +4482,11 @@ int _gc_destroy_garbage(void* data, void* extra) {
|
|||||||
instance = (_class_t*)data;
|
instance = (_class_t*)data;
|
||||||
_HT_FOREACH(instance->scope->var_dict, _do_nothing_on_object, _gc_destroy_garbage_in_class, gc);
|
_HT_FOREACH(instance->scope->var_dict, _do_nothing_on_object, _gc_destroy_garbage_in_class, gc);
|
||||||
_ht_clear(instance->scope->var_dict);
|
_ht_clear(instance->scope->var_dict);
|
||||||
|
_ls_clear(instance->meta_list);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif /* MB_ENABLE_CLASS */
|
#endif /* MB_ENABLE_CLASS */
|
||||||
default:
|
default: /* Do nothing */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(ref->count) {
|
if(ref->count) {
|
||||||
@ -5483,7 +5484,6 @@ void _unref_class(_ref_t* ref, void* data) {
|
|||||||
|
|
||||||
void _destroy_class(_class_t* c) {
|
void _destroy_class(_class_t* c) {
|
||||||
/* Destroy a class instance */
|
/* Destroy a class instance */
|
||||||
safe_free(c->name);
|
|
||||||
if(c->meta_list) {
|
if(c->meta_list) {
|
||||||
_unlink_meta_class(c->ref.s, c);
|
_unlink_meta_class(c->ref.s, c);
|
||||||
_ls_destroy(c->meta_list);
|
_ls_destroy(c->meta_list);
|
||||||
@ -5494,6 +5494,7 @@ void _destroy_class(_class_t* c) {
|
|||||||
}
|
}
|
||||||
safe_free(c->scope);
|
safe_free(c->scope);
|
||||||
_destroy_ref(&c->ref);
|
_destroy_ref(&c->ref);
|
||||||
|
safe_free(c->name);
|
||||||
safe_free(c);
|
safe_free(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user