Commit 6e23caa3 authored by Matthew Jones's avatar Matthew Jones Committed by Commit Bot

Fix tab leak in BottomSheetController

Previously the BottomSheetController held on to the last activity tab
until a new tab was selected. This caused a memory leak if all tabs
were closed. This patch clears the last active tab if that tab is
destroyed.

Bug: 891094
Change-Id: I84343727dba0719792e115675153c8fffba5346d
Reviewed-on: https://chromium-review.googlesource.com/1256812Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595952}
parent 3f703e12
...@@ -113,6 +113,11 @@ public class BottomSheetController implements ApplicationStatus.ActivityStateLis ...@@ -113,6 +113,11 @@ public class BottomSheetController implements ApplicationStatus.ActivityStateLis
public void onCrash(Tab tab, boolean sadTabShown) { public void onCrash(Tab tab, boolean sadTabShown) {
clearRequestsAndHide(); clearRequestsAndHide();
} }
@Override
public void onDestroyed(Tab tab) {
if (mLastActivityTab == tab) mLastActivityTab = null;
}
}; };
mTabProvider.addObserverAndTrigger(new HintlessActivityTabObserver() { mTabProvider.addObserverAndTrigger(new HintlessActivityTabObserver() {
......
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