diff options
author | dgp <dgp@users.sourceforge.net> | 2011-08-11 20:04:57 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-08-11 20:04:57 (GMT) |
commit | 9e8e84dc847e0669451db6b792ee3b0e8bb5b0cf (patch) | |
tree | b12c8abba5a4cdbc83b996503c168368c2a56f30 | |
parent | ba9424ed9813043dd8948d59a0fd5aa83b0cd0ca (diff) | |
download | tcl-bug_3389764.zip tcl-bug_3389764.tar.gz tcl-bug_3389764.tar.bz2 |
Proposed fix for 3389764. Have "path" dup routine duplicate the pattern
bug_3389764
of a value with a cyclic reference to itself. Don't keep a reference to
the value getting dup'd so the assumptions of cycle prevention in bytecode
compilation are satisfied.
-rw-r--r-- | generic/tclPathObj.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index d9e3973..205c301 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -2617,29 +2617,29 @@ DupFsPathInternalRep( SETPATHOBJ(copyPtr, copyFsPathPtr); - if (srcFsPathPtr->translatedPathPtr != NULL) { + if (srcFsPathPtr->translatedPathPtr == srcPtr) { + /* Cycle in src -> make cycle in copy. */ + copyFsPathPtr->translatedPathPtr = copyPtr; + } else { copyFsPathPtr->translatedPathPtr = srcFsPathPtr->translatedPathPtr; - if (copyFsPathPtr->translatedPathPtr != copyPtr) { + if (copyFsPathPtr->translatedPathPtr != NULL) { Tcl_IncrRefCount(copyFsPathPtr->translatedPathPtr); } - } else { - copyFsPathPtr->translatedPathPtr = NULL; } - if (srcFsPathPtr->normPathPtr != NULL) { + if (srcFsPathPtr->normPathPtr == srcPtr) { + /* Cycle in src -> make cycle in copy. */ + copyFsPathPtr->normPathPtr = copyPtr; + } else { copyFsPathPtr->normPathPtr = srcFsPathPtr->normPathPtr; - if (copyFsPathPtr->normPathPtr != copyPtr) { + if (copyFsPathPtr->normPathPtr != NULL) { Tcl_IncrRefCount(copyFsPathPtr->normPathPtr); } - } else { - copyFsPathPtr->normPathPtr = NULL; } - if (srcFsPathPtr->cwdPtr != NULL) { - copyFsPathPtr->cwdPtr = srcFsPathPtr->cwdPtr; + copyFsPathPtr->cwdPtr = srcFsPathPtr->cwdPtr; + if (copyFsPathPtr->cwdPtr != NULL) { Tcl_IncrRefCount(copyFsPathPtr->cwdPtr); - } else { - copyFsPathPtr->cwdPtr = NULL; } copyFsPathPtr->flags = srcFsPathPtr->flags; |