summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorChris Banes <chrisbanes@google.com>2015-06-22 10:05:38 +0100
committerChris Banes <chrisbanes@google.com>2015-06-22 10:05:38 +0100
commit601bb9921d47be42857c1fe5e1c2172e4400b756 (patch)
tree4addb377bcbdd886e528c45adb0c51dec787cc99 /core/java/android
parentcb8bb3900178c126b9f101e84edd07bb6b489637 (diff)
downloadframeworks_base-601bb9921d47be42857c1fe5e1c2172e4400b756.zip
frameworks_base-601bb9921d47be42857c1fe5e1c2172e4400b756.tar.gz
frameworks_base-601bb9921d47be42857c1fe5e1c2172e4400b756.tar.bz2
Fix leak for MenuInflater + setActionBar
Caused when there are multiple calls to setActionBar(). getMenuInflater() will instantiate and keep an instance to the first Toolbar (and it's container, etc). BUG: 21638877 Change-Id: Ic9e45bf8f810a033c31b7484244f14e08a72b9f4
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Activity.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 1b4ee2e..e8ab109 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2075,6 +2075,9 @@ public class Activity extends ContextThemeWrapper
"by the window decor. Do not request Window.FEATURE_ACTION_BAR and set " +
"android:windowActionBar to false in your theme to use a Toolbar instead.");
}
+ // Clear out the MenuInflater to make sure that it is valid for the new Action Bar
+ mMenuInflater = null;
+
ToolbarActionBar tbab = new ToolbarActionBar(toolbar, getTitle(), this);
mActionBar = tbab;
mWindow.setCallback(tbab.getWrappedWindowCallback());