Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 601bb992 authored by Chris Banes's avatar Chris Banes
Browse files

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
parent cb8bb390
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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());