summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-04-22 13:28:42 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-04-22 13:28:42 (GMT)
commitd513bef710d0493a82bb07fb74a37dd723a82c5d (patch)
tree28651ab9e0c403ba8a03d62db596808f7382059c
parent751fe9de93be33eda7b7e4d3a8efe71e4c27d84c (diff)
parentdc6bc431e92971fa4f3d95ed3f277e4e90c8191c (diff)
downloadtcl-d513bef710d0493a82bb07fb74a37dd723a82c5d.zip
tcl-d513bef710d0493a82bb07fb74a37dd723a82c5d.tar.gz
tcl-d513bef710d0493a82bb07fb74a37dd723a82c5d.tar.bz2
merge 8.7
-rw-r--r--generic/tclExecute.c3
-rw-r--r--generic/tclVar.c3
-rw-r--r--tests/var.test16
3 files changed, 18 insertions, 4 deletions
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index be192e2..fb8c5fc 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -3747,7 +3747,8 @@ TEBCresume(
}
TRACE(("%s %u \"%.30s\" => ",
(flags ? "normal" : "noerr"), opnd, O2S(part2Ptr)));
- if (TclIsVarArray(arrayPtr) && !UnsetTraced(arrayPtr)) {
+ if (TclIsVarArray(arrayPtr) && !UnsetTraced(arrayPtr)
+ && !(arrayPtr->flags & VAR_SEARCH_ACTIVE)) {
varPtr = VarHashFindVar(arrayPtr->value.tablePtr, part2Ptr);
if (varPtr && TclIsVarDirectUnsettable(varPtr)) {
/*
diff --git a/generic/tclVar.c b/generic/tclVar.c
index 2a5d68b..4db73da 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -5497,9 +5497,6 @@ DeleteArray(
Tcl_Obj *objPtr;
VarTrace *tracePtr;
- if (varPtr->flags & VAR_SEARCH_ACTIVE) {
- DeleteSearches(iPtr, varPtr);
- }
for (elPtr = VarHashFirstVar(varPtr->value.tablePtr, &search);
elPtr != NULL; elPtr = VarHashNextVar(&search)) {
if (TclIsVarScalar(elPtr) && (elPtr->value.objPtr != NULL)) {
diff --git a/tests/var.test b/tests/var.test
index b65c1d5..a279dfd 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -778,6 +778,22 @@ test var-13.1 {Tcl_UnsetVar2, unset array with trace set on element} -setup {
}
set x "If you see this, it worked"
} -result "If you see this, it worked"
+test var-13.2 {unset array with search, bug 46a2410650} -body {
+ apply {{} {
+ array set a {aa 11 bb 22 cc 33 dd 44 ee 55 ff 66}
+ set s [array startsearch a]
+ unset a([array nextelement a $s])
+ array nextelement a $s
+ }}
+} -returnCodes error -result {couldn't find search "s-1-a"}
+test var-13.3 {unset array with search, SIGSEGV, bug 46a2410650} -body {
+ apply {{} {
+ array set a {aa 11 bb 22 cc 33 dd 44 ee 55 ff 66}
+ set s [array startsearch a]
+ unset a(ff)
+ array nextelement a $s
+ }}
+} -returnCodes error -result {couldn't find search "s-1-a"}
test var-14.1 {array names syntax} -body {
array names foo bar baz snafu