[Webkit-unassigned] [Bug 232922] bad_optional_access in RenderGrid::updateAutoMarginsInRowAxisIfNeeded

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 11 10:25:19 PST 2021


--- Comment #5 from Gabriel Nava Marino <gnavamarino at apple.com> ---
Comment on attachment 443774
  --> https://bugs.webkit.org/attachment.cgi?id=443774

View in context: https://bugs.webkit.org/attachment.cgi?id=443774&action=review

Thank you for the feedback on the stylistic issues.

>> Source/WebCore/rendering/RenderGrid.cpp:1226
>> +    std::optional<LayoutUnit> availableWidth = child.overridingContainingBlockContentLogicalWidth();
> Although this seems correct I don't get why we have nullopt in the overriding size here. These two methods are called after calling updateGridAreaBreathLogicalSize() which always sets the overrides. That's why we were calling value() directly here without checking the presence of the value. Do you have more info about the exact conditions that trigger the bad access?

I note that these values are set in updateGridAreaBreathLogicalSize(), but later cleared in applyStretchAlignmentToChildIfNeeded:

    // We clear height and width override values because we will decide now whether it's allowed or
    // not, evaluating the conditions which might have changed since the old values were set.

>> Source/WebCore/rendering/RenderGrid.cpp:1260
>> +    std::optional<LayoutUnit> availableHeight = child.overridingContainingBlockContentLogicalHeight();
> Maybe we could just use value_or(LayoutUnit()) as we already do in other functions of this class to handle the available space. In case of nullopt, we will use the early return already defined for non-positive values.

Thank you, I will use the recommended approach.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211111/5e884308/attachment.htm>

More information about the webkit-unassigned mailing list