Index: generic/nsf.c =================================================================== diff -u -r4ab0ae5f442b577cd4b874b756d162f597459788 -r646eda3ca72ca90d25809865bf1e51c6d940af7a --- generic/nsf.c (.../nsf.c) (revision 4ab0ae5f442b577cd4b874b756d162f597459788) +++ generic/nsf.c (.../nsf.c) (revision 646eda3ca72ca90d25809865bf1e51c6d940af7a) @@ -19131,6 +19131,15 @@ NsfObjDispatch, NsfObjDispatchNRE, object, TclDeletesObject); +# if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION>6 + /* + * We have to invalidate the intRep of the Tcl_Obj, otherwise - at least + * when the incoming type is cmdName - a later call to + * Tcl_GetCommandFromObj() will not pick up the new cmd. At least, we do not + * get the cmd we have created here (object->id). + */ + TclFreeIntRep(nameObj); +# endif #else object->id = Tcl_CreateObjCommand(interp, nameString, NsfObjDispatch, object, TclDeletesObject); @@ -19669,22 +19678,15 @@ NsfObjDispatch, NsfObjDispatchNRE, cl, TclDeletesObject); - -#if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION>6 +# if TCL_MAJOR_VERSION==8 && TCL_MINOR_VERSION>6 /* - * It seems, that we have to invalidate the intRep of the Tcl_Obj, otherwise - * - at least when the incoming type is cmdName - a later call to - * Tcl_GetCommandFromObj() will pick up the wrong/old cmd. At least, we do - * not get the cmd we have created here (object->id). + * We have to invalidate the intRep of the Tcl_Obj, otherwise - at least + * when the incoming type is cmdName - a later call to + * Tcl_GetCommandFromObj() will not pick up the new cmd. At least, we do not + * get the cmd we have created here (object->id). */ - if (nameObj->typePtr != NULL) { - if ((nameObj->typePtr != NULL) && (nameObj->typePtr->freeIntRepProc != NULL)) { - /*fprintf(stderr, "PrimitiveCCreate cmd %p invalidates intRep for nameObj %p type %s\n", - object->id, nameObj, nameObj->typePtr->name);*/ - nameObj->typePtr->freeIntRepProc(nameObj); - } - } -#endif + TclFreeIntRep(nameObj); +# endif #else object->id = Tcl_CreateObjCommand(interp, nameString, NsfObjDispatch, cl, TclDeletesObject);