summaryrefslogtreecommitdiffstats
path: root/generic/tclNamesp.c
diff options
context:
space:
mode:
authorMiguel Sofer <miguel.sofer@gmail.com>2008-03-02 18:46:37 (GMT)
committerMiguel Sofer <miguel.sofer@gmail.com>2008-03-02 18:46:37 (GMT)
commit8f94a1b5df88af853e56efc184d49d5914b5866e (patch)
tree45814bb0416f5956368446e2cdc3111932e908bc /generic/tclNamesp.c
parent067866ce3e28f843d05e2acf9933d20d16a44d57 (diff)
downloadtcl-8f94a1b5df88af853e56efc184d49d5914b5866e.zip
tcl-8f94a1b5df88af853e56efc184d49d5914b5866e.tar.gz
tcl-8f94a1b5df88af853e56efc184d49d5914b5866e.tar.bz2
* generic/tclNamesp.c (GetNamespaceFromObj): spoil the intrep of
an nsNameType obj when the reference crosses interpreter boundaries.
Diffstat (limited to 'generic/tclNamesp.c')
-rw-r--r--generic/tclNamesp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/generic/tclNamesp.c b/generic/tclNamesp.c
index 9baf60d..f7fa9c1 100644
--- a/generic/tclNamesp.c
+++ b/generic/tclNamesp.c
@@ -23,7 +23,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclNamesp.c,v 1.161 2007/12/13 15:23:19 dgp Exp $
+ * RCS: @(#) $Id: tclNamesp.c,v 1.162 2008/03/02 18:46:39 msofer Exp $
*/
#include "tclInt.h"
@@ -2699,18 +2699,20 @@ GetNamespaceFromObj(
Tcl_Namespace **nsPtrPtr) /* Result namespace pointer goes here. */
{
ResolvedNsName *resNamePtr;
- Namespace *nsPtr;
+ Namespace *nsPtr, *refNsPtr;
if (objPtr->typePtr == &nsNameType) {
/*
- * Check that the ResolvedNsName is still valid.
+ * Check that the ResolvedNsName is still valid; avoid letting the ref
+ * cross interps.
*/
resNamePtr = (ResolvedNsName *) objPtr->internalRep.twoPtrValue.ptr1;
nsPtr = resNamePtr->nsPtr;
- if (!(nsPtr->flags & NS_DYING)
- && ((resNamePtr->refNsPtr == NULL) || (resNamePtr->refNsPtr
- == (Namespace *) Tcl_GetCurrentNamespace(interp)))) {
+ refNsPtr = resNamePtr->refNsPtr;
+ if (!(nsPtr->flags & NS_DYING) && (interp == nsPtr->interp) &&
+ (!refNsPtr || ((interp == refNsPtr->interp) &&
+ (refNsPtr== (Namespace *) Tcl_GetCurrentNamespace(interp))))) {
*nsPtrPtr = (Tcl_Namespace *) nsPtr;
return TCL_OK;
}