Commit 2f6d9f2b authored by Brett Kilty's avatar Brett Kilty Committed by Commit Bot

Protect against double destruction

No definitive repro, but found in several large
automated test runs with rapid activity on device.
All protect this remaining member against access
after destruction.

Bug: b/163868029
Test: Local execution, no regression
Change-Id: Icaf5e73f10f75e6edcf414c830b8eb99611b4b27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2503637Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Commit-Queue: Brett Kilty <brettk@google.com>
Cr-Commit-Position: refs/heads/master@{#822051}
parent 384775c1
......@@ -248,6 +248,11 @@ public final class UnownedUserDataHost {
public void destroy() {
mThreadChecker.assertOnValidThread();
if (isDestroyed()) {
// Protect against potential races.
return;
}
// Create a shallow copy of all keys to ensure each held object can safely remove itself
// from the map while iterating over their keys.
Set<UnownedUserDataKey<?>> keys = new HashSet<>(mUnownedUserDataMap.keySet());
......
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