summaryrefslogtreecommitdiffstats
path: root/generic/tclOOBasic.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-02-02 09:13:45 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-02-02 09:13:45 (GMT)
commitdfbab38ae547e10b74c8c13190efc5015aa52b43 (patch)
tree0c0523334c2ccbee685dbb680e15f8246d65f1a8 /generic/tclOOBasic.c
parenta702b6e0b90ad920f1bd8821d028e281991f64ab (diff)
downloadtcl-dfbab38ae547e10b74c8c13190efc5015aa52b43.zip
tcl-dfbab38ae547e10b74c8c13190efc5015aa52b43.tar.gz
tcl-dfbab38ae547e10b74c8c13190efc5015aa52b43.tar.bz2
[Bug 2944404] Be careful in case an object deletes itself in its destructor.
Diffstat (limited to 'generic/tclOOBasic.c')
-rw-r--r--generic/tclOOBasic.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclOOBasic.c b/generic/tclOOBasic.c
index 193ca93..2c42fe9 100644
--- a/generic/tclOOBasic.c
+++ b/generic/tclOOBasic.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclOOBasic.c,v 1.22 2010/01/28 13:57:48 dkf Exp $
+ * RCS: @(#) $Id: tclOOBasic.c,v 1.23 2010/02/02 09:13:45 dkf Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -267,6 +267,7 @@ TclOO_Object_Destroy(
NULL);
return TCL_ERROR;
}
+ AddRef(oPtr);
if (!(oPtr->flags & DESTRUCTOR_CALLED)) {
CallContext *contextPtr =
TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL);
@@ -280,8 +281,10 @@ TclOO_Object_Destroy(
TclOODeleteContext(contextPtr);
}
}
- Tcl_DeleteCommandFromToken(interp,
- Tcl_GetObjectCommand(Tcl_ObjectContextObject(context)));
+ if (oPtr->command) {
+ Tcl_DeleteCommandFromToken(interp, oPtr->command);
+ }
+ DelRef(oPtr);
return result;
}