Commit 0b974927 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Handle multiple ProfileDestroyers correctly

Multiple ProfileDestroyers destroying a single Profile is sorted out
in ProfileDestroyer::DestroyOffTheRecordProfileNow by the first
destroyer nulling out the pointer to the Profile in the others so they
won't destroy the same Profile again.

It has a bug breaking out the loop after handling the first one. The
right way is finding and nulling out all the Destroyers. This CL
fixes it.

Bug: 1029677
Change-Id: I7d8efe60a28613040e0a2afd9db0640ea3602c2d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2113391
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#752594}
parent e6e0446d
......@@ -122,8 +122,7 @@ void ProfileDestroyer::DestroyOffTheRecordProfileNow(Profile* const profile) {
// these potential leaks, but we handle it in release so that we don't
// crash or corrupt profile data on disk.
LOG(WARNING) << "A render process host wasn't destroyed early enough.";
(*i)->profile_ = NULL;
break;
(*i)->profile_ = nullptr;
}
}
}
......@@ -163,7 +162,7 @@ ProfileDestroyer::ProfileDestroyer(Profile* const profile, HostSet* hosts)
ProfileDestroyer::~ProfileDestroyer() {
if (profile_) {
ProfileDestroyer::DestroyOffTheRecordProfileNow(profile_);
profile_ = nullptr;
DCHECK(!profile_);
}
// Once the profile is deleted, all renderer hosts must have been deleted.
......
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