From c6235e92861d6446970ede30f5089fb60e9a2d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=AF=E6=AD=8C?= Date: Fri, 14 Jun 2024 10:51:42 +0800 Subject: [PATCH] fix a recyclerview's crash caused by wild pointer(mSmoothScroller) --- src/gui/widgetEx/recyclerview/recyclerview.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widgetEx/recyclerview/recyclerview.cc b/src/gui/widgetEx/recyclerview/recyclerview.cc index b108b499..e171d9de 100755 --- a/src/gui/widgetEx/recyclerview/recyclerview.cc +++ b/src/gui/widgetEx/recyclerview/recyclerview.cc @@ -3362,6 +3362,7 @@ void RecyclerView::ViewFlinger::run() { } } // call this after the onAnimation is complete not to have inconsistent callbacks etc. + smoothScroller = mRV->mLayout->mSmoothScroller;/*mSmoothScroller maybe nulled in mRV->setScrollState.*/ if (smoothScroller != nullptr) { if (smoothScroller->isPendingInitialRun()) { smoothScroller->onAnimation(0, 0); @@ -6531,6 +6532,7 @@ RecyclerView::SmoothScroller::SmoothScroller() { mTargetPosition = RecyclerView::NO_POSITION; mRecyclerView = nullptr; mLayoutManager = nullptr; + mTargetView = nullptr; mRecyclingAction = new Action(0, 0); }