Chromium Code Reviews
DescriptionFix crash when calling ScrollAnchor::clear from PaintLayer's destructor
ScrollAnchor::clear walks up the PaintLayer chain from the anchor (or its
scroller's LayoutBox if anchor is null). It unconditionally clears the
isScrollAnchorObject bit because the assumption is that if any ancestor
scroller had this LayoutObject as its anchor, it will be cleared anyway. This
only applies to clears caused by scrolling.
For example, say that you have a nested scroller (#nested) and a main frame
scroller (#main). Say that the nested scroller has a div (#div) that has its own
PaintLayer (see the test added in this CL).
Say that both #main and #nested are anchored to #something inside #nested. If
#nested is removed, ScrollAnchor::clear will first be called on #div's PLSA.
This will do nothing for #div (since it doesn't have an anchor), but will clear
the scroll anchor for #main (and not #nested because layoutObject->parent() is null
since #div is detached from the tree).
After a call to ScrollAnchor::clear on the #div's PLSA, the IsScrollAnchorObject
bit on #something is cleared. But, #nested still holds a reference to #something
because LayoutObject::willBeRemovedFromTree check whether the IsScrollAnchorObject
bit is set before clearing referencing scrollers. Then ScrollAnchor::clear will be
called on #nested's PLSA and we will be working with a stale anchor.
BUG=656314
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Committed: https://crrev.com/889397888480b49f01ed18a04ce9eb05f30ca2b5
Cr-Commit-Position: refs/heads/master@{#426314}
Patch Set 1 #
Messages
Total messages: 16 (8 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||