ViewGroup::removeAllViewsInLayout ,mChildren.clear must be called earlier to avoid some crash

This commit is contained in:
houzh 2023-11-21 13:00:22 +08:00
parent b894f260bb
commit 6b8a7bbd03

View File

@ -1550,6 +1550,7 @@ void ViewGroup::removeAllViewsInLayout() {
mChildren[i] = nullptr;//cant delete mChilden[i]
}
mChildren.clear();
if (mDefaultFocus) clearDefaultFocus(mDefaultFocus);
if (mFocusedInCluster) clearFocusedInCluster(mFocusedInCluster);
@ -1560,7 +1561,6 @@ void ViewGroup::removeAllViewsInLayout() {
notifyGlobalFocusCleared(focused);
}
}
mChildren.clear();
}
bool ViewGroup::removeViewInternal(View* view){