All pastes #614904 Raw Edit

Mine

public text v1 · immutable
·published 2007-07-11 21:01 UTC
rendered paste body
Index: src/collection.cpp
===================================================================
--- src/collection.cpp  (revision 81816)
+++ src/collection.cpp  (working copy)
@@ -17,6 +17,7 @@
 #include "brush.h"
 #include "animation.h"
 #include "transform.h"
+#include "namescope.h"
 
 Collection::Node::Node (DependencyObject *dob, DependencyObject *parent)
 {
@@ -64,6 +65,11 @@
        list->Append (new Collection::Node (data, this));
        data->Attach (NULL, this);
 
+       NameScope *ns = data->FindNameScope ();
+       NameScope *con_ns = ((DependencyObject *) closure)->FindNameScope ();
+       if (ns && con_ns && ns != con_ns)
+               con_ns->MergeTemporaryScope (ns);
+
        if (closure)
                closure->OnCollectionChanged (this, CollectionChangeTypeItemAdded, data, NULL);
 }
@@ -78,6 +84,11 @@
 
        data->Attach (NULL, this);
 
+       NameScope *ns = data->FindNameScope ();
+       NameScope *con_ns = ((DependencyObject *) closure)->FindNameScope ();
+       if (ns && con_ns && ns != con_ns)
+               con_ns->MergeTemporaryScope (ns);
+
        if (closure)
                closure->OnCollectionChanged (this, CollectionChangeTypeItemAdded, data, NULL);
 }