From f887621bde119a1d5212ed918da217dd3aef2588 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 2 Feb 2010 16:13:46 +0000 Subject: Ensure that decrements never assume that they can't do (actual) deletion. --- generic/tclVar.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index 775c864..9977975 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclVar.c,v 1.160.2.7 2010/02/02 00:42:41 dkf Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.160.2.8 2010/02/02 16:13:46 dkf Exp $ */ #include "tclInt.h" @@ -3218,7 +3218,9 @@ Tcl_ArrayObjCmd( */ if (varPtr2 == protectedVarPtr) { - VarHashRefCount(varPtr2)--; + if (VarHashRefCount(varPtr2)-- == 1) { + CleanupVar(varPtr2, varPtr); + } } /* @@ -3247,7 +3249,9 @@ Tcl_ArrayObjCmd( */ if (protectedVarPtr) { - VarHashRefCount(protectedVarPtr)--; + if (VarHashRefCount(protectedVarPtr)-- == 1) { + CleanupVar(protectedVarPtr, varPtr); + } } return TCL_ERROR; } -- cgit v0.12