From: mdejong Date: Thu, 19 Oct 2000 04:31:53 +0000 (+0000) Subject: * itcl/generic/itcl_objects.c (Itcl_CreateObject): X-Git-Tag: cygwin-1-1-7~144 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=fe4b8bf58400765af2082f2e0db1f9f97244cfb9;p=pf3gnuchains%2Fpf3gnuchains4x.git * itcl/generic/itcl_objects.c (Itcl_CreateObject): Add code to check for an object that deletes itself inside its own constructor. We need to avoid adding this object to the global object list. --- diff --git a/itcl/ChangeLog b/itcl/ChangeLog index eb4e1328d2..b3e25017ba 100644 --- a/itcl/ChangeLog +++ b/itcl/ChangeLog @@ -1,3 +1,10 @@ +2000-10-13 Mo DeJong + + * itcl/generic/itcl_objects.c (Itcl_CreateObject): + Add code to check for an object that deletes itself + inside its own constructor. We need to avoid adding + this object to the global object list. + 2000-06-22 Syd Polk * itcl/win/Makefile.in: Added target install-shared-libraries. diff --git a/itcl/itcl/generic/itcl_objects.c b/itcl/itcl/generic/itcl_objects.c index fa1ab2ff21..ec3d4e2186 100644 --- a/itcl/itcl/generic/itcl_objects.c +++ b/itcl/itcl/generic/itcl_objects.c @@ -250,9 +250,15 @@ Itcl_CreateObject(interp, name, cdefn, objc, objv, roPtr) newObj->constructed = NULL; /* - * Add it to the list of all known objects. + * Add it to the list of all known objects. The only + * tricky thing to watch out for is the case where the + * object deleted itself inside its own constructor. + * In that case, we don't want to add the object to + * the list of valid objects. We can determine that + * the object deleted itself by checking to see if its + * accessCmd member is NULL. */ - if (result == TCL_OK) { + if ((result == TCL_OK) && (newObj->accessCmd != NULL)) { entry = Tcl_CreateHashEntry(&cdefnPtr->info->objects, (char*)newObj->accessCmd, &newEntry);