Skip to content

Commit b1181df

Browse files
Jiwon-Kim-s3EleVen
authored andcommitted
Fixed Handler Leak on RecyclerView
A MotionEvent object is not recycled in case of error at onTouchEvent function. @OverRide public boolean onTouchEvent(MotionEvent e) { ... final MotionEvent vtev = MotionEvent.obtain(e); ... case MotionEvent.ACTION_MOVE: { final int index = e.findPointerIndex(mScrollPointerId); if (index < 0) { Log.e(TAG, "Error processing scroll; pointer index for id " + mScrollPointerId + " not found. Did any MotionEvents get skipped?"); return false; } ... } Test: Manual Signed-off-by: Jiwon Kim <jiwon88.kim@samsung.com> Change-Id: I8390a5d8c78b306a6c81dce9d41ceffe93bfdeb7 Signed-off-by: Akash Srivastava <akashniki@gmail.com>
1 parent 7c7b048 commit b1181df

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

core/java/com/android/internal/widget/RecyclerView.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,7 @@ public boolean onTouchEvent(MotionEvent e) {
27992799
if (index < 0) {
28002800
Log.e(TAG, "Error processing scroll; pointer index for id "
28012801
+ mScrollPointerId + " not found. Did any MotionEvents get skipped?");
2802+
vtev.recycle();
28022803
return false;
28032804
}
28042805

0 commit comments

Comments
 (0)