Import Tcl 8.6.12
This commit is contained in:
@@ -583,6 +583,10 @@ Tcl_CreateInterp(void)
|
||||
Tcl_InitHashTable(&iPtr->packageTable, TCL_STRING_KEYS);
|
||||
iPtr->packageUnknown = NULL;
|
||||
|
||||
#ifdef _WIN32
|
||||
# define getenv(x) _wgetenv(L##x) /* On Windows, use _wgetenv below */
|
||||
#endif
|
||||
|
||||
/* TIP #268 */
|
||||
if (getenv("TCL_PKG_PREFER_LATEST") == NULL) {
|
||||
iPtr->packagePrefer = PKG_PREFER_STABLE;
|
||||
@@ -3205,6 +3209,19 @@ Tcl_DeleteCommandFromToken(
|
||||
iPtr->compileEpoch++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Delete any imports of this routine elsewhere before calling deleteProc
|
||||
* to that traces on the imports don't reference deallocated storage.
|
||||
*/
|
||||
if (!(cmdPtr->flags & CMD_REDEF_IN_PROGRESS)) {
|
||||
for (refPtr = cmdPtr->importRefPtr; refPtr != NULL;
|
||||
refPtr = nextRefPtr) {
|
||||
nextRefPtr = refPtr->nextPtr;
|
||||
importCmd = (Tcl_Command) refPtr->importedCmdPtr;
|
||||
Tcl_DeleteCommandFromToken(interp, importCmd);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmdPtr->deleteProc != NULL) {
|
||||
/*
|
||||
* Delete the command's client data. If this was an imported command
|
||||
@@ -3224,20 +3241,6 @@ Tcl_DeleteCommandFromToken(
|
||||
cmdPtr->deleteProc(cmdPtr->deleteData);
|
||||
}
|
||||
|
||||
/*
|
||||
* If this command was imported into other namespaces, then imported
|
||||
* commands were created that refer back to this command. Delete these
|
||||
* imported commands now.
|
||||
*/
|
||||
if (!(cmdPtr->flags & CMD_REDEF_IN_PROGRESS)) {
|
||||
for (refPtr = cmdPtr->importRefPtr; refPtr != NULL;
|
||||
refPtr = nextRefPtr) {
|
||||
nextRefPtr = refPtr->nextPtr;
|
||||
importCmd = (Tcl_Command) refPtr->importedCmdPtr;
|
||||
Tcl_DeleteCommandFromToken(interp, importCmd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't use hPtr to delete the hash entry here, because it's possible
|
||||
* that the deletion callback renamed the command. Instead, use
|
||||
@@ -3328,7 +3331,6 @@ CallCommandTraces(
|
||||
}
|
||||
}
|
||||
cmdPtr->flags |= CMD_TRACE_ACTIVE;
|
||||
cmdPtr->refCount++;
|
||||
|
||||
result = NULL;
|
||||
active.nextPtr = iPtr->activeCmdTracePtr;
|
||||
@@ -3386,7 +3388,6 @@ CallCommandTraces(
|
||||
*/
|
||||
|
||||
cmdPtr->flags &= ~CMD_TRACE_ACTIVE;
|
||||
cmdPtr->refCount--;
|
||||
iPtr->activeCmdTracePtr = active.nextPtr;
|
||||
Tcl_Release(iPtr);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user