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)
commitf887621bde119a1d5212ed918da217dd3aef2588 (patch)
treedab3ebc74bbcc75f783e9a7246bbd571171ae07b /generic
parentc1534c208e4eee03061c52b2d7de3ded03f8de37 (diff)
downloadtcl-f887621bde119a1d5212ed918da217dd3aef2588.zip
tcl-f887621bde119a1d5212ed918da217dd3aef2588.tar.gz
tcl-f887621bde119a1d5212ed918da217dd3aef2588.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;
}