Commit a8fe83ae authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Forget then deactivate (#6885)

...so that when you detach, you still have the slot, the parentData, etc.
parent 18362ec6
...@@ -2198,8 +2198,8 @@ abstract class Element implements BuildContext { ...@@ -2198,8 +2198,8 @@ abstract class Element implements BuildContext {
}); });
final Element parent = element._parent; final Element parent = element._parent;
if (parent != null) { if (parent != null) {
parent.deactivateChild(element);
parent.forgetChild(element); parent.forgetChild(element);
parent.deactivateChild(element);
} }
assert(element._parent == null); assert(element._parent == null);
owner._inactiveElements.remove(element); owner._inactiveElements.remove(element);
...@@ -2262,11 +2262,11 @@ abstract class Element implements BuildContext { ...@@ -2262,11 +2262,11 @@ abstract class Element implements BuildContext {
/// ///
/// This method (indirectly) calls [deactivate] on the child. /// This method (indirectly) calls [deactivate] on the child.
/// ///
/// The caller is responsible from removing the child from its child model. /// The caller is responsible for removing the child from its child model.
/// Typically [deactivateChild] is called by the element itself while it is /// Typically [deactivateChild] is called by the element itself while it is
/// updating its child model; however, during [GlobalKey] reparenting, the new /// updating its child model; however, during [GlobalKey] reparenting, the new
/// parent proactively calls [deactivateChild] and then uses [forgetChild] to /// parent proactively calls the old parent's [deactivateChild], first using
/// update this object's child model. /// [forgetChild] to cause the old parent to update its child model.
@protected @protected
void deactivateChild(Element child) { void deactivateChild(Element child) {
assert(child != null); assert(child != null);
...@@ -2289,9 +2289,8 @@ abstract class Element implements BuildContext { ...@@ -2289,9 +2289,8 @@ abstract class Element implements BuildContext {
/// This updates the child model such that, e.g., [visitChildren] does not /// This updates the child model such that, e.g., [visitChildren] does not
/// walk that child anymore. /// walk that child anymore.
/// ///
/// The element must have already been deactivated (via [deactivateChild]) /// The element will still have a valid parent when this is called. After this
/// when this is called, meaning that it and its render object should both be /// is called, [deactivateChild] is called to sever the link to this object.
/// orphans (their respective parents should be null).
@protected @protected
void forgetChild(Element child); void forgetChild(Element child);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment