diff options
| author | 2016-01-06 02:55:06 +0000 | |
|---|---|---|
| committer | 2016-01-06 02:55:06 +0000 | |
| commit | 1ee3e370f9f92721c3ea06344a4e2e80a1bf1bed (patch) | |
| tree | 296c9cfb2fa8fbdfe87b6205fd03262eb89d7915 | |
| parent | 7e6040d981285920901b290641aa67b5e3cabc24 (diff) | |
| parent | 151778998ae6087c17cae4916a2c02eb59558daa (diff) | |
Merge "Fixing crash in D&D due to race conditions during drag end."
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index cd93dab0c48b..1c243929fa49 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -1419,8 +1419,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager case DragEvent.ACTION_DRAG_ENDED: { // Release the bookkeeping now that the drag lifecycle has ended - if (mChildrenInterestedInDrag != null) { - for (View child : mChildrenInterestedInDrag) { + final HashSet<View> childrenInterestedInDrag = mChildrenInterestedInDrag; + if (childrenInterestedInDrag != null) { + for (View child : childrenInterestedInDrag) { // If a child was interested in the ongoing drag, it's told that it's over if (child.dispatchDragEvent(event)) { retval = true; @@ -1428,12 +1429,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager child.mPrivateFlags2 &= ~View.DRAG_MASK; child.refreshDrawableState(); } - - mChildrenInterestedInDrag.clear(); - if (mCurrentDragStartEvent != null) { - mCurrentDragStartEvent.recycle(); - mCurrentDragStartEvent = null; - } + childrenInterestedInDrag.clear(); + } + if (mCurrentDragStartEvent != null) { + mCurrentDragStartEvent.recycle(); + mCurrentDragStartEvent = null; } if (mIsInterestedInDrag) { |