Crash when accessing removed parent in InlineTextBox.
authorinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jan 2012 18:33:05 +0000 (18:33 +0000)
committerinferno@chromium.org <inferno@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jan 2012 18:33:05 +0000 (18:33 +0000)
commit5a1933485a6ed31c88b9708482254b37c0865608
treebd65710b565eb1c44dfa494994d4a271f062485c
parentcd9f1b3cc3060c06eca0c6b8edf78e582c64ad5c
Crash when accessing removed parent in InlineTextBox.
https://bugs.webkit.org/show_bug.cgi?id=72982

Reviewed by James Robinson.

Source/WebCore:

The crash happens because:
1. We add heading element(h1) before the span element(span1),
   causing splitflow on the anonymous block containing BeforeText,
   span1(and SpanText) and AfterText.
2. span1 moves to the cloneBlock (continuation).
3. Our anonymous block and cloneBlock are both marked for layout,
   however we still have a copy of our lineboxes with its childs
   as the textboxes belonging to SpanText.
4. Our anonymous block only child BeforeText is getting removed,
   so we dont have any children anymore and we delete our lineboxes,
   leaving behind the children textboxes belonging to SpanText.
5. SpanText is getting destroyed, so it tries to inform removed
   parent lineboxes causing the crash.

Test: fast/block/block-remove-child-delete-line-box-crash.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::removeChild):

LayoutTests:

Tests passes if it does not crash on ASSERT(!m_hasBadParent)
in InlineBox::parent().

* fast/block/block-remove-child-delete-line-box-crash-expected.txt: Added.
* fast/block/block-remove-child-delete-line-box-crash.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/block/block-remove-child-delete-line-box-crash-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/block-remove-child-delete-line-box-crash.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp