drawablecontainer's code format and memleak

This commit is contained in:
侯歌 2024-08-01 17:16:43 +08:00
parent 9f82cec89a
commit f09a0c1a0b
2 changed files with 3 additions and 2 deletions

View File

@ -161,6 +161,7 @@ void DrawableContainer::DrawableContainerState::createAllFutures(){
for (int keyIndex = 0; keyIndex < futureCount; keyIndex++) {
const int index= mDrawableFutures.keyAt(keyIndex);
std::shared_ptr<ConstantState>cs =mDrawableFutures.valueAt(keyIndex);
delete mDrawables[index];
mDrawables[index] = prepareDrawable(cs->newDrawable());
}
mDrawableFutures.clear();

View File

@ -38,8 +38,8 @@ protected:
int mTintMode;
ColorFilter*mColorFilter;
const ColorStateList*mTintList;
std::vector<Drawable* >mDrawables;
SparseArray<std::shared_ptr<ConstantState> >mDrawableFutures;
std::vector<Drawable*>mDrawables;
SparseArray<std::shared_ptr<ConstantState>>mDrawableFutures;
DrawableContainerState(const DrawableContainerState*orig,DrawableContainer*own);
~DrawableContainerState()override;
DrawableContainer*newDrawable()override{return nullptr;}//must be overrided by inherited