diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-01-25 14:39:55 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-01-25 14:39:55 (GMT) |
commit | d8825c9e6dfd8da03e34620cfa6cabe25d2f78ce (patch) | |
tree | cd1368cc4eeee7ad19d71b6daad4256bcffb9205 /generic/tclOO.c | |
parent | 23a8b5ab99c77ba24e4cb3b7b4ff95813316b66b (diff) | |
download | tcl-d8825c9e6dfd8da03e34620cfa6cabe25d2f78ce.zip tcl-d8825c9e6dfd8da03e34620cfa6cabe25d2f78ce.tar.gz tcl-d8825c9e6dfd8da03e34620cfa6cabe25d2f78ce.tar.bz2 |
* generic/tclOO.c (Tcl_CopyObjectInstance): [Bug 3474460]: When
copying an object, make sure that the configuration of the variable
resolver is also duplicated.
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r-- | generic/tclOO.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index 8b76eeb..8ac2039 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1643,7 +1643,7 @@ Tcl_CopyObjectInstance( FOREACH_HASH_DECLS; Method *mPtr; Class *mixinPtr; - Tcl_Obj *keyPtr, *filterObj; + Tcl_Obj *keyPtr, *filterObj, *variableObj; int i; /* @@ -1712,6 +1712,15 @@ Tcl_CopyObjectInstance( } /* + * Copy the object's variable resolution list to the new object. + */ + + DUPLICATE(o2Ptr->variables, oPtr->variables, Tcl_Obj *); + FOREACH(variableObj, o2Ptr->variables) { + Tcl_IncrRefCount(variableObj); + } + + /* * Copy the object's flags to the new object, clearing those that must be * kept object-local. The duplicate is never deleted at this point, nor is * it the root of the object system or in the midst of processing a filter @@ -1794,6 +1803,15 @@ Tcl_CopyObjectInstance( } /* + * Copy the source class's variable resolution list. + */ + + DUPLICATE(cls2Ptr->variables, clsPtr->variables, Tcl_Obj *); + FOREACH(variableObj, cls2Ptr->variables) { + Tcl_IncrRefCount(variableObj); + } + + /* * Duplicate the source class's mixins (which cannot be circular * references to the duplicate). */ |