OSDN Git Service

* itcl/generic/itcl_objects.c (Itcl_CreateObject):
authormdejong <mdejong>
Thu, 19 Oct 2000 04:31:53 +0000 (04:31 +0000)
committermdejong <mdejong>
Thu, 19 Oct 2000 04:31:53 +0000 (04:31 +0000)
        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.

itcl/ChangeLog
itcl/itcl/generic/itcl_objects.c

index eb4e132..b3e2501 100644 (file)
@@ -1,3 +1,10 @@
+2000-10-13  Mo DeJong  <mdejong@redhat.com>
+
+       * 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  <spolk@redhat.com>
 
        * itcl/win/Makefile.in: Added target install-shared-libraries.
index fa1ab2f..ec3d4e2 100644 (file)
@@ -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);