Commit 791bd8b5 authored by Hixie's avatar Hixie

Fix crash when a MixedViewport is initially offset at a non-zero position.

We need to always remove the widget when you sync a non-visible
widget, even if we already have it, because otherwise we'll try to
sync it with null again later, which causes a crash.

Test in #938.
parent 2d0d82e0
......@@ -372,14 +372,13 @@ class MixedViewport extends RenderObjectWrapper {
}
_Key widgetKey = new _Key.fromWidget(widget);
if (offsets.last > startOffset) {
// it's visible
newChildren[widgetKey] = widget;
builtChildren[startIndex] = widget;
break;
}
if (!childrenByKey.containsKey(widgetKey)) {
// we don't actually need this one, release it
syncChild(null, widget, null);
} // else we'll get rid of it later, when we remove old children
childrenByKey.remove(widgetKey);
syncChild(null, widget, null);
startIndex += 1;
assert(startIndex == offsets.length - 1);
}
......
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