Commit 45d07239 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Prevent BubbleDialogModelHost infinite recursion

CalculatePreferredSize() calls GetHeightForWidth() which calls
CalculatePreferredSize() if there's no LayoutManager installed.

This change adds a new LayoutManager as a workaround that should not be
necessary (see linked bugs).

Bug: 1128500, 1135104
Change-Id: I0563e3b8c39c892dca84d488f207ebbb0deb4594
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2448772
Commit-Queue: Peter Boström <pbos@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarDavid Bienvenu <davidbienvenu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#813802}
parent 37c74c52
......@@ -207,7 +207,11 @@ void BubbleDialogModelHost::Close() {
// TODO(pbos): Note that this is in place because GridLayout doesn't handle
// View removal correctly (keeps stale pointers). This is in place to prevent
// UAFs between Widget::Close() and destroying |this|.
SetLayoutManager(nullptr);
// TODO(pbos): This uses a non-nullptr LayoutManager only to prevent infinite
// recursion in CalculatePreferredSize(). CalculatePreferredSize calls
// GetHeightForWidth(), which if there is no LayoutManager calls
// GetPreferredSize(). See https://crbug.com/1128500.
SetLayoutManager(std::make_unique<GridLayout>());
// TODO(pbos): Consider turning this into for-each-field remove field.
RemoveAllChildViews(true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment