From 31e49061d4e683754c4b8f59ee363a275b359d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Sat, 27 Mar 1999 23:04:05 +0100 Subject: [PATCH] really_free_object() now leaves o->parent alone, so that it can be used by destroy() later. Rev: src/object.c:1.66 --- src/object.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/object.c b/src/object.c index 2378eeef3e..f6c783f6a4 100644 --- a/src/object.c +++ b/src/object.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: object.c,v 1.65 1999/03/26 19:29:53 hubbe Exp $"); +RCSID("$Id: object.c,v 1.66 1999/03/27 22:04:05 grubba Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -370,6 +370,7 @@ void destruct(struct object *o) if(!BEGIN_CYCLIC(o,0)) { SET_CYCLIC_RET(1); + /* fprintf(stderr, "destruct(): Calling destroy().\n"); */ safe_apply_low(o, e, 0); pop_stack(); END_CYCLIC(); @@ -387,6 +388,8 @@ void destruct(struct object *o) if(o->parent) { + /* fprintf(stderr, "destruct(): Zapping parent.\n"); */ + free_object(o->parent); o->parent=0; } @@ -485,12 +488,6 @@ void really_free_object(struct object *o) if(--o->refs > 0) return; } - if(o->parent) - { - free_object(o->parent); - o->parent=0; - } - if(o->prev) o->prev->next=o->next; else @@ -511,6 +508,14 @@ void really_free_object(struct object *o) o->prev=0; objects_to_destruct=o; } else { + if(o->parent) + { + /* fprintf(stderr, "really_free_object(): Zapping parent.\n"); */ + + free_object(o->parent); + o->parent=0; + } + FREE_PROT(o); free((char *)o); GC_FREE(); -- GitLab