diff options
author | Adam Powell <adamp@google.com> | 2010-08-30 18:33:20 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-30 18:33:20 -0700 |
commit | 4c72ad75cfb413f54cb59d413a232e77c7260ef2 (patch) | |
tree | 82b00b4c6ae323bb8a3e104834fec0ff61b78371 /core | |
parent | 8d60866e2100db70ecf0502c14768a384514d7e9 (diff) | |
parent | 9c17a4c11005877b65d841f4fbd810df89c7c206 (diff) | |
download | frameworks_base-4c72ad75cfb413f54cb59d413a232e77c7260ef2.zip frameworks_base-4c72ad75cfb413f54cb59d413a232e77c7260ef2.tar.gz frameworks_base-4c72ad75cfb413f54cb59d413a232e77c7260ef2.tar.bz2 |
Merge "Fix bug 2918587 Infinite loop and memory leak in AdapterView" into gingerbread
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/AdapterView.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index 10a8729..8fcc2e8 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -808,7 +808,6 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { mNextSelectedPosition = INVALID_POSITION; mNextSelectedRowId = INVALID_ROW_ID; mNeedSync = false; - checkSelectionChanged(); checkFocus(); requestLayout(); @@ -819,13 +818,21 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { } } - private class SelectionNotifier extends Handler implements Runnable { + @Override + protected void onDetachedFromWindow() { + super.onDetachedFromWindow(); + removeCallbacks(mSelectionNotifier); + } + + private class SelectionNotifier implements Runnable { public void run() { if (mDataChanged) { // Data has changed between when this SelectionNotifier // was posted and now. We need to wait until the AdapterView // has been synched to the new data. - post(this); + if (getAdapter() != null) { + post(this); + } } else { fireOnSelected(); } @@ -842,7 +849,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { if (mSelectionNotifier == null) { mSelectionNotifier = new SelectionNotifier(); } - mSelectionNotifier.post(mSelectionNotifier); + post(mSelectionNotifier); } else { fireOnSelected(); } |