Commit a60842e8 authored by Bruce Dawson's avatar Bruce Dawson Committed by Chromium LUCI CQ

Detect modifications to children_ vector

Crash analysis suggests that items are being removed from the children_
vector while we are iterating over it. This can easily turn into an
infinite loop as the iter == end condition is never met, and calling
destructors on bad objects leads to confusing crashes. This checks for
that condition in order to validate the theory and get closer to
understanding these crashes.

Bug: 1152152
Change-Id: If30d7943e3f6d69ec000a82b656b5086e21bb7b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2576034
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834264}
parent 802749a1
......@@ -220,6 +220,7 @@ View::~View() {
{
internal::ScopedChildrenLock lock(this);
auto child_count = children_.size();
for (auto* child : children_) {
line_number_trace[(next_line_entry++) % kNumEntries] = __LINE__;
child->parent_ = nullptr;
......@@ -238,6 +239,7 @@ View::~View() {
if (child)
vtable = reinterpret_cast<void**>(child)[0];
delete child;
CHECK_EQ(child_count, children_.size());
}
line_number_trace[(next_line_entry++) % kNumEntries] = __LINE__;
}
......
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