Unverified Commit d1f02ae0 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Short-circuit _debugCanPerformMutations if debugDoingLayout is false (#81246)

parent 6beafa7b
...@@ -1359,11 +1359,18 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -1359,11 +1359,18 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
/// Whether tree mutations are currently permitted. /// Whether tree mutations are currently permitted.
/// ///
/// Only valid when asserts are enabled. In release builds, always returns /// This is only useful during layout. One should also not mutate the tree at
/// null. /// other times (e.g. during paint or while assembling the semantic tree) but
/// this function does not currently enforce those conventions.
///
/// Only valid when asserts are enabled. This will throw in release builds.
bool get _debugCanPerformMutations { bool get _debugCanPerformMutations {
late bool result; late bool result;
assert(() { assert(() {
if (owner != null && !owner!.debugDoingLayout) {
result = true;
return true;
}
RenderObject node = this; RenderObject node = this;
while (true) { while (true) {
if (node._doingThisLayoutWithCallback) { if (node._doingThisLayoutWithCallback) {
......
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