Skip to content

Commit 7e7b791

Browse files
Theresa WellingtonTheresa
Theresa Wellington
authored and
Theresa
committed
[Home] Fix app menu crash on JellyBean
JellyBean crashes if a header is added to a ListView after the adapter has been set. Switch the order of adding the header and setting the adapter. BUG=761726 [email protected] Change-Id: I1cfafe3b437667469d28fc9f3cc79ed0137a1faf Reviewed-on: https://chromium-review.googlesource.com/650626 Reviewed-by: Matthew Jones <[email protected]> Commit-Queue: Theresa <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#499674} Reviewed-on: https://chromium-review.googlesource.com/653419 Reviewed-by: Theresa <[email protected]> Cr-Commit-Position: refs/branch-heads/3202@{#49} Cr-Branched-From: fa6a5d8-refs/heads/master@{#499098}
1 parent 3e9eebc commit 7e7b791

File tree

1 file changed

+4
-1
lines changed
  • chrome/android/java/src/org/chromium/chrome/browser/appmenu

1 file changed

+4
-1
lines changed

chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,16 @@ void show(Context context, final View anchorView, boolean isByPermanentButton,
255255
ViewGroup contentView =
256256
(ViewGroup) LayoutInflater.from(context).inflate(R.layout.app_menu_layout, null);
257257
mListView = (ListView) contentView.findViewById(R.id.app_menu_list);
258-
mListView.setAdapter(mAdapter);
259258

260259
int footerHeight =
261260
inflateFooter(footerResourceId, contentView, menuWidth, highlightedItemId);
262261
int headerHeight =
263262
inflateHeader(headerResourceId, headerOnClickListener, context, menuWidth);
264263

264+
// Set the adapter after the header is added to avoid crashes on JellyBean.
265+
// See crbug.com/761726.
266+
mListView.setAdapter(mAdapter);
267+
265268
int popupHeight = setMenuHeight(menuItems.size(), visibleDisplayFrame, screenHeight,
266269
sizingPadding, footerHeight, headerHeight, anchorView);
267270
int[] popupPosition = getPopupPosition(mCurrentScreenRotation, visibleDisplayFrame,

0 commit comments

Comments
 (0)