From: Carlos Garcia Campos Date: Fri, 6 Mar 2015 07:33:11 +0000 (+0000) Subject: Fix segfault when calling clearSelection on a detached RenderObject X-Git-Tag: archive/raspbian/2.14.3-1+rpi1~1^2^2^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=988659fc29d37dd872e9699d53b5b906a80ac96f;p=webkit2gtk.git Fix segfault when calling clearSelection on a detached RenderObject =================================================================== Gbp-Pq: Name fix-clearselection-segfault.patch --- diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index ed7e012de0..0e0d51e8b7 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -1828,6 +1828,8 @@ LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const #endif RenderBlock* cb = containingBlock(); + if (!cb) + return LayoutUnit(); return cb->availableLogicalWidth(); } @@ -1839,6 +1841,8 @@ LayoutUnit RenderBox::containingBlockLogicalHeightForContent(AvailableLogicalHei #endif RenderBlock* cb = containingBlock(); + if (!cb) + return LayoutUnit(); return cb->availableLogicalHeight(heightType); } diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index d6095315ca..c950b16cd1 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -1105,7 +1105,7 @@ void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re void RenderView::clearSelection() { layer()->repaintBlockSelectionGaps(); - setSelection(0, -1, 0, -1, RepaintNewMinusOld); + setSelection(nullptr, -1, nullptr, -1, RepaintNewMinusOld); } bool RenderView::printing() const