summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-02-02 16:13:46 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-02-02 16:13:46 (GMT)
commite2e8dacfbd902fec0d9897cd61c92275d0f603f3 (patch)
treedab3ebc74bbcc75f783e9a7246bbd571171ae07b /generic
parentda2f5e31dccc789a2f1abc9f4da092bef8cee19e (diff)
downloadtcl-e2e8dacfbd902fec0d9897cd61c92275d0f603f3.zip
tcl-e2e8dacfbd902fec0d9897cd61c92275d0f603f3.tar.gz
tcl-e2e8dacfbd902fec0d9897cd61c92275d0f603f3.tar.bz2
Ensure that decrements never assume that they can't do (actual) deletion.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclVar.c10
1 files 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;
}