diff options
| author | Adam Powell <adamp@google.com> | 2010-08-30 18:35:58 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-30 18:35:58 -0700 |
| commit | 7d04f2bc4e38d5d7d2b37d6dec76fb3793311341 (patch) | |
| tree | 1dab523a18127ae9eec438ab07db84293a4acb84 /core/java/android/widget/AdapterView.java | |
| parent | 36f0cb26cbb4ef62995ff2e5a540cf8814e7f030 (diff) | |
| parent | 4c72ad75cfb413f54cb59d413a232e77c7260ef2 (diff) | |
am 4c72ad75: Merge "Fix bug 2918587 Infinite loop and memory leak in AdapterView" into gingerbread
Merge commit '4c72ad75cfb413f54cb59d413a232e77c7260ef2' into gingerbread-plus-aosp
* commit '4c72ad75cfb413f54cb59d413a232e77c7260ef2':
Fix bug 2918587 Infinite loop and memory leak in AdapterView
Diffstat (limited to 'core/java/android/widget/AdapterView.java')
| -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 10a87295ccf5..8fcc2e87a966 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(); } |
