Fixed race condition regarding first child max height

The scroller could crash due to a race condition when updating
the maxheight of the first view.

Bug: 14295010
Change-Id: I911c724a26c8624e2326118e3b392ee675001bc6
This commit is contained in:
Selim Cinek
2014-04-28 20:23:30 +02:00
parent c955677c1b
commit 2ba5f1f4e3

View File

@@ -542,9 +542,13 @@ public class StackScrollAlgorithm {
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight,
int oldBottom) {
mFirstChildMaxHeight = getMaxAllowedChildHeight(
mFirstChildWhileExpanding);
mFirstChildWhileExpanding.removeOnLayoutChangeListener(this);
if (mFirstChildWhileExpanding != null) {
mFirstChildMaxHeight = getMaxAllowedChildHeight(
mFirstChildWhileExpanding);
} else {
mFirstChildMaxHeight = 0;
}
v.removeOnLayoutChangeListener(this);
}
});
} else {