From ba35bf55aadcbf80978088d454eef25deb67b5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Tue, 14 Apr 1998 13:04:39 -0700 Subject: [PATCH] cyclic destroy() prevented Rev: src/object.c:1.45 --- src/object.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/object.c b/src/object.c index d2d955e3d8..72534520d2 100644 --- a/src/object.c +++ b/src/object.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: object.c,v 1.44 1998/04/09 02:42:31 hubbe Exp $"); +RCSID("$Id: object.c,v 1.45 1998/04/14 20:04:39 hubbe Exp $"); #include "object.h" #include "dynamic_buffer.h" #include "interpret.h" @@ -21,6 +21,7 @@ RCSID("$Id: object.c,v 1.44 1998/04/09 02:42:31 hubbe Exp $"); #include "callback.h" #include "cpp.h" #include "builtin_functions.h" +#include "cyclic.h" #include "dmalloc.h" @@ -247,8 +248,15 @@ void destruct(struct object *o) e=FIND_LFUN(o->prog,LFUN_DESTROY); if(e != -1) { - safe_apply_low(o, e, 0); - pop_stack(); + /* We do not want to call destroy() if it already being called */ + DECLARE_CYCLIC(); + if(!BEGIN_CYCLIC(o,0)) + { + SET_CYCLIC_RET(1); + safe_apply_low(o, e, 0); + pop_stack(); + END_CYCLIC(); + } } /* destructed in destroy() */ -- GitLab