diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2010-02-02 09:13:45 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2010-02-02 09:13:45 (GMT) |
| commit | a11c2e522afe5b018dfcf24c22d45ff318dcfe60 (patch) | |
| tree | 0c0523334c2ccbee685dbb680e15f8246d65f1a8 /generic/tclOOBasic.c | |
| parent | 2cc9e7f1102676c83c44d46f96ec34c00a92214e (diff) | |
| download | tcl-a11c2e522afe5b018dfcf24c22d45ff318dcfe60.zip tcl-a11c2e522afe5b018dfcf24c22d45ff318dcfe60.tar.gz tcl-a11c2e522afe5b018dfcf24c22d45ff318dcfe60.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.c | 9 |
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; } |
