diff options
author | John Reck <jreck@google.com> | 2010-12-06 10:27:39 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2010-12-06 13:50:23 -0800 |
commit | 59280307b381a247a2f6a5299a5893f5f5337306 (patch) | |
tree | 61e018e1a5ad871666f5287d078eea1dc9640217 | |
parent | 3f83159b1cd8c732337d966be575233f0d1cae90 (diff) | |
download | packages_apps_Browser-59280307b381a247a2f6a5299a5893f5f5337306.zip packages_apps_Browser-59280307b381a247a2f6a5299a5893f5f5337306.tar.gz packages_apps_Browser-59280307b381a247a2f6a5299a5893f5f5337306.tar.bz2 |
Fixes race condition in HistoryAdapter
Bug: 3245076
There was a race condition between the two loaders. If most visited
finished loading first, history would crash.
Change-Id: I561edffe0cadef452b5fa2d621466bf23a9c57cf
-rw-r--r-- | src/com/android/browser/BrowserHistoryPage.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index e9db667..f99e7b5 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -376,7 +376,6 @@ public class BrowserHistoryPage extends Fragment @Override public long getChildId(int groupPosition, int childPosition) { - if (!mDataValid) return 0; if (moveCursorToChildPosition(groupPosition, childPosition)) { Cursor cursor = getCursor(groupPosition); return cursor.getLong(HistoryQuery.INDEX_ID); @@ -418,7 +417,9 @@ public class BrowserHistoryPage extends Fragment public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (groupPosition >= super.getGroupCount()) { - if (!mDataValid) throw new IllegalStateException("Data is not valid"); + if (mMostVisited == null || mMostVisited.isClosed()) { + throw new IllegalStateException("Data is not valid"); + } TextView item; if (null == convertView || !(convertView instanceof TextView)) { LayoutInflater factory = LayoutInflater.from(getContext()); @@ -436,7 +437,7 @@ public class BrowserHistoryPage extends Fragment boolean moveCursorToChildPosition( int groupPosition, int childPosition) { if (groupPosition >= super.getGroupCount()) { - if (mDataValid && !mMostVisited.isClosed()) { + if (mMostVisited != null && !mMostVisited.isClosed()) { mMostVisited.moveToPosition(childPosition); return true; } |