Subject: Cherrypick again. Add test.

From: dgp <[email-masked]>
Date: Mon, 4 Feb 2013 18:38:41 +0000

---
 generic/tclVar.c | 6 ------
 tests/set.test   | 5 +++++
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/generic/tclVar.c b/generic/tclVar.c
index 4458dac..d000296 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -70,9 +70,6 @@ VarHashCreateVar(
     }
 }
 
-/*
- * Callers must Incr key if they plan to Decr it.
- */
 #define VarHashFindVar(tablePtr, key) \
     VarHashCreateVar((tablePtr), (key), NULL)
 #define VarHashInvalidateEntry(varPtr) \
@@ -4987,13 +4984,11 @@ Tcl_FindNamespaceVar(
     Tcl_Obj *namePtr = Tcl_NewStringObj(name, -1);
     Tcl_Var var;
 
-    Tcl_IncrRefCount(namePtr);
     var = ObjFindNamespaceVar(interp, namePtr, contextNsPtr, flags);
     Tcl_DecrRefCount(namePtr);
     return var;
 }
 
-/* Callers must incr namePtr if they plan to decr it. */
 static Tcl_Var
 ObjFindNamespaceVar(
     Tcl_Interp *interp,		/* The interpreter in which to find the
@@ -5463,7 +5458,6 @@ TclInfoLocalsCmd(
  *
  * Side effects:
  *	None.
- *	Caller must incr patternPtr if they plan to decr it.
  *
  *----------------------------------------------------------------------
  */
diff --git a/tests/set.test b/tests/set.test
index 9e0ddc0..cad951b 100644
--- a/tests/set.test
+++ b/tests/set.test
@@ -521,6 +521,11 @@ test set-5.1 {error on malformed array name} testset2 {
     list $msg $msg1
 } {{can't read "z(a)(b)": variable isn't array} {can't read "z(b)(a)": variable isn't array}}
 
+# In a mem-debug build, this test will crash unless Bug 3602706 is fixed.
+test set-5.2 {Bug 3602706} -body {
+    testset2 ::tcl_platform not-in-there
+} -returnCodes error -result * -match glob
+
 # cleanup
 catch {unset a}
 catch {unset b}
-- 
cgit v0.12