Commit 12bc3b42 authored by David Maunder's avatar David Maunder Committed by Commit Bot

Don't remove observer after Tab#destroy()

We enforce that CriticalPersistedTabData observers cannot
be removed after destroy() - this causes the app to crash.
We should check the tab is initialized before doing this.

Bug: 1117396
Change-Id: I38d794536e6571de273bd51d50da3a157e792290
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410732Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: David Maunder <davidjm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808079}
parent abe92ed7
......@@ -137,7 +137,9 @@ public class TabModelSelectorTabObserver
for (int j = 0; j < comprehensiveTabList.getCount(); j++) {
Tab tab = comprehensiveTabList.getTabAt(j);
tab.removeObserver(this);
CriticalPersistedTabData.from(tab).removeObserver(this);
if (tab.isInitialized()) {
CriticalPersistedTabData.from(tab).removeObserver(this);
}
onTabUnregistered(tab);
}
}
......
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