From ee2ddea6e375270013c0bbe70e83853301efc279 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 11 Feb 2010 09:00:53 +0000 Subject: [Bug 2949397]: Prevent destructors from running on the two core class objects when the whole interpreter is being destroyed. --- ChangeLog | 6 ++++++ generic/tclOO.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 695fb0d..ae76f05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-02-11 Donal K. Fellows + + * generic/tclOO.c (ObjectRenamedTrace): [Bug 2949397]: Prevent + destructors from running on the two core class objects when the whole + interpreter is being destroyed. + 2010-02-09 Donal K. Fellows * generic/tclCompCmds.c (TclCompileTryCmd, IssueTryInstructions) diff --git a/generic/tclOO.c b/generic/tclOO.c index f52ff35..507f8b5 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOO.c,v 1.30 2010/02/05 20:53:12 nijtmans Exp $ + * RCS: @(#) $Id: tclOO.c,v 1.31 2010/02/11 09:00:55 dkf Exp $ */ #ifdef HAVE_CONFIG_H @@ -660,13 +660,20 @@ ObjectRenamedTrace( * command. Because of that case, we must take care here to mark the * command as being deleted so that if we return here we don't run into * reentrancy problems. + * + * We also do not run destructors on the core class objects when the + * interpreter is being deleted; their incestuous nature causes problems + * in that case when the destructor is partially deleted before the uses + * of it have gone. [Bug 2949397] */ AddRef(oPtr); oPtr->command = NULL; oPtr->flags |= OBJECT_DELETED; - if (!(oPtr->flags & DESTRUCTOR_CALLED)) { + if (!(oPtr->flags & DESTRUCTOR_CALLED) && (!Tcl_InterpDeleted(interp) + || (oPtr != oPtr->fPtr->objectCls->thisPtr + && oPtr != oPtr->fPtr->classCls->thisPtr))) { contextPtr = TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL); oPtr->flags |= DESTRUCTOR_CALLED; if (contextPtr != NULL) { -- cgit v0.12