Index: Source/WebCore/rendering/RenderBlock.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderBlock.cpp (revision 119645) |
+++ Source/WebCore/rendering/RenderBlock.cpp (working copy) |
@@ -601,7 +601,13 @@ |
RenderBoxModelObject* curr = toRenderBoxModelObject(parent()); |
RenderBoxModelObject* currChild = this; |
RenderObject* currChildNextSibling = currChild->nextSibling(); |
- |
+ bool documentUsesBeforeAfterRules = document()->usesBeforeAfterRules(); |
+ |
+ // Note: |this| can be destroyed inside this loop if it is an empty anonymous |
+ // block and we try to call updateBeforeAfterContent inside which removes the |
+ // generated content and additionally cleans up |this| empty anonymous block. |
+ // See RenderBlock::removeChild(). DO NOT reference any local variables to |this| |
+ // after this point. |
while (curr && curr != fromBlock) { |
ASSERT(curr->isRenderBlock()); |
@@ -628,7 +634,7 @@ |
// has to move into the inline continuation. Call updateBeforeAfterContent to ensure that the inline's :after |
// content gets properly destroyed. |
bool isLastChild = (currChildNextSibling == blockCurr->lastChild()); |
- if (document()->usesBeforeAfterRules()) |
+ if (documentUsesBeforeAfterRules) |
blockCurr->children()->updateBeforeAfterContent(blockCurr, AFTER); |
if (isLastChild && currChildNextSibling != blockCurr->lastChild()) |
currChildNextSibling = 0; // We destroyed the last child, so now we need to update |
@@ -638,8 +644,7 @@ |
// Since we are doing layout anyway, it is easier to blow away the entire list, than |
// traversing down the subtree looking for positioned children and then remove them |
// from our positioned objects list. |
- if (currChildNextSibling) |
- blockCurr->removePositionedObjects(0); |
+ blockCurr->removePositionedObjects(0); |
// Now we need to take all of the children starting from the first child |
// *after* currChild and append them all to the clone. |