summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--generic/tclObj.c26
2 files changed, 27 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 98e2b01..a3efa5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-05-23 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclObj.c (tclCmdNameType): Converted internal rep
+ management of the cmdName Tcl_ObjType the opposite way, to always
+ use the twoPtrValue instead of always using the otherValuePtr.
+ Previous fix on 2003-05-12 broke several extensions that wanted
+ to poke around with the twoPtrValue.ptr2 value of a cmdName
+ Tcl_Obj, like TclBlend and e4graph. [Bug 726018]
+
2003-05-23 Mo DeJong <mdejong@users.sourceforge.net>
* unix/mkLinks: Set the var S to "" at the top
diff --git a/generic/tclObj.c b/generic/tclObj.c
index cf536a3..97db9f4 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclObj.c,v 1.46 2003/05/12 19:32:43 dgp Exp $
+ * RCS: @(#) $Id: tclObj.c,v 1.47 2003/05/23 21:29:51 dgp Exp $
*/
#include "tclInt.h"
@@ -156,6 +156,13 @@ Tcl_HashKeyType tclObjHashKeyType = {
* type cache the Command pointer that results from looking up command names
* in the command hashtable. Such objects appear as the zeroth ("command
* name") argument in a Tcl command.
+ *
+ * NOTE: the ResolvedCmdName that gets cached is stored in the
+ * twoPtrValue.ptr1 field, and the twoPtrValue.ptr2 field is unused.
+ * You might think you could use the simpler otherValuePtr field to
+ * store the single ResolvedCmdName pointer, but DO NOT DO THIS. It
+ * seems that some extensions use the second internal pointer field
+ * of the twoPtrValue field for their own purposes.
*/
static Tcl_ObjType tclCmdNameType = {
@@ -2884,7 +2891,7 @@ Tcl_GetCommandFromObj(interp, objPtr)
return (Tcl_Command) NULL;
}
}
- resPtr = (ResolvedCmdName *) objPtr->internalRep.otherValuePtr;
+ resPtr = (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1;
/*
* Get the current namespace.
@@ -2923,7 +2930,7 @@ Tcl_GetCommandFromObj(interp, objPtr)
iPtr->varFramePtr = savedFramePtr;
return (Tcl_Command) NULL;
}
- resPtr = (ResolvedCmdName *) objPtr->internalRep.otherValuePtr;
+ resPtr = (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1;
if (resPtr != NULL) {
cmdPtr = resPtr->cmdPtr;
}
@@ -2992,7 +2999,8 @@ TclSetCmdNameObj(interp, objPtr, cmdPtr)
if ((oldTypePtr != NULL) && (oldTypePtr->freeIntRepProc != NULL)) {
oldTypePtr->freeIntRepProc(objPtr);
}
- objPtr->internalRep.otherValuePtr = (VOID *) resPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr;
+ objPtr->internalRep.twoPtrValue.ptr2 = NULL;
objPtr->typePtr = &tclCmdNameType;
}
@@ -3023,7 +3031,7 @@ FreeCmdNameInternalRep(objPtr)
* representation to free. */
{
register ResolvedCmdName *resPtr =
- (ResolvedCmdName *) objPtr->internalRep.otherValuePtr;
+ (ResolvedCmdName *) objPtr->internalRep.twoPtrValue.ptr1;
if (resPtr != NULL) {
/*
@@ -3072,9 +3080,10 @@ DupCmdNameInternalRep(srcPtr, copyPtr)
register Tcl_Obj *copyPtr; /* Object with internal rep to set. */
{
register ResolvedCmdName *resPtr =
- (ResolvedCmdName *) srcPtr->internalRep.otherValuePtr;
+ (ResolvedCmdName *) srcPtr->internalRep.twoPtrValue.ptr1;
- copyPtr->internalRep.otherValuePtr = (VOID *) resPtr;
+ copyPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr;
+ copyPtr->internalRep.twoPtrValue.ptr2 = NULL;
if (resPtr != NULL) {
resPtr->refCount++;
}
@@ -3169,7 +3178,8 @@ SetCmdNameFromAny(interp, objPtr)
objPtr->typePtr->freeIntRepProc(objPtr);
}
- objPtr->internalRep.otherValuePtr = (VOID *) resPtr;
+ objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) resPtr;
+ objPtr->internalRep.twoPtrValue.ptr2 = NULL;
objPtr->typePtr = &tclCmdNameType;
return TCL_OK;
}