summaryrefslogtreecommitdiffstats
path: root/generic/tclOO.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-01-25 14:39:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-01-25 14:39:55 (GMT)
commit68fbac8d0f24ffb16077c6c3ecd6c1a61ab16bb1 (patch)
treecd1368cc4eeee7ad19d71b6daad4256bcffb9205 /generic/tclOO.c
parent8df49a02756833a2aefa9dcba660412037e4f1c4 (diff)
downloadtcl-68fbac8d0f24ffb16077c6c3ecd6c1a61ab16bb1.zip
tcl-68fbac8d0f24ffb16077c6c3ecd6c1a61ab16bb1.tar.gz
tcl-68fbac8d0f24ffb16077c6c3ecd6c1a61ab16bb1.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.c20
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).
*/