Commit bf333d35 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix a crash opening a new tab

HistoryNavigationCoordinator can keep a reference to a Tab already
destroyed. This CL observes TabObserver.onDestroyed to null out the
reference to such tab. This ensures the clean up task against an
already-destroyed object like SwipeRefreshHandler avoids an exception.

Bug: 1043584
Change-Id: I37e0e0a78cd227a1f1413576eeba3801cd147e8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010753Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733803}
parent 99319be7
...@@ -65,6 +65,11 @@ public class HistoryNavigationCoordinator ...@@ -65,6 +65,11 @@ public class HistoryNavigationCoordinator
initNavigationHandler( initNavigationHandler(
tab, createDelegate(tab), tab.getWebContents(), tab.isNativePage()); tab, createDelegate(tab), tab.getWebContents(), tab.isNativePage());
} }
@Override
public void onDestroyed(Tab tab) {
mTab = null;
}
}; };
// We wouldn't hear about the first tab until the content changed or we switched tabs // We wouldn't hear about the first tab until the content changed or we switched tabs
......
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