summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Carr <racarr@google.com> 2017-05-15 17:21:38 -0700
committer Robert Carr <racarr@google.com> 2017-05-15 17:29:20 -0700
commit001e55a17a8ff58ae80409369601ba860f8e8832 (patch)
tree0e6449e94f15ee0b47c9ccc93f26abaa406cc3f6
parentef090ac32df0f9fbf0300c343dbb733f281569d4 (diff)
ViewRootImpl: Guard against null in performMeasure
In particular we are seeing this in the call sites from performTraversals in monkey crashes. I don't have exact repro but it seems like a feasible state to get in to...for example...WindowManagerGlobal#addView can trigger removal of a dying view immediately without respect for the mIsInTraversal flag when it calls doDie(). This means we can dispatch detached from window setting mView == null while performing a traversal. There's some question about why this doDie is even required but...seems a little nerve wrecking to change at the moment and it seems best to just guard against null for now. Test: Monkeys will test. Bug: 37343098 Change-Id: I94f2569c1ef70819c083f2b2b34b59622e6c6260
-rw-r--r--core/java/android/view/ViewRootImpl.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 1f13220289c2..f6cb30d40687 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2410,6 +2410,9 @@ public final class ViewRootImpl implements ViewParent,
}
private void performMeasure(int childWidthMeasureSpec, int childHeightMeasureSpec) {
+ if (mView == null) {
+ return;
+ }
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "measure");
try {
mView.measure(childWidthMeasureSpec, childHeightMeasureSpec);