fux imageview's double free (for file loading)

This commit is contained in:
houzh 2022-03-15 14:38:41 +00:00
parent 210d02acfd
commit 9ab092a0df
5 changed files with 20 additions and 13 deletions

View File

@ -10,12 +10,12 @@ BitmapDrawable::BitmapState::BitmapState(){
mBaseAlpha= 1.0f;
mAlpha = 255;
mTint = nullptr;
mTransparency= -1;
mTintMode = DEFAULT_TINT_MODE;
mTileModeX =mTileModeY=-1;
mAutoMirrored= false;
mSrcDensityOverride=0;
mTargetDensity=160;
mTransparency = -1;
mTintMode = DEFAULT_TINT_MODE;
mTileModeX = mTileModeY = -1;
mAutoMirrored = false;
mSrcDensityOverride = 0;
mTargetDensity = 160;
mChangingConfigurations=0;
}

View File

@ -42,13 +42,14 @@ void ImageView::initImageView(){
mViewAlphaScale= 256;
mDrawableWidth = mDrawableHeight = -1;
mScaleType = FIT_CENTER;
mHaveFrame = true;
mMergeState = false;
mCropToPadding= false;
mDrawable = nullptr;
mHaveFrame = true;
mDrawMatrix= identity_matrix();
mCropToPadding = false;
mAdjustViewBounds = false;
mDrawable = nullptr;
mDrawMatrix = identity_matrix();
mMatrix = identity_matrix();
mRecycleableBitmapDrawable= nullptr;
mRecycleableBitmapDrawable = nullptr;
mMaxWidth = mMaxHeight = INT_MAX;
mDrawableTintList = nullptr;
mColorFilter = nullptr;
@ -56,10 +57,11 @@ void ImageView::initImageView(){
}
ImageView::~ImageView() {
if(mDrawable!=mRecycleableBitmapDrawable)
delete mRecycleableBitmapDrawable;
delete mDrawable;
delete mDrawableTintList;
delete mColorFilter;
delete mRecycleableBitmapDrawable;
}
void ImageView::resolveUri(){

View File

@ -906,6 +906,10 @@ TabLayout::TabView::TabView(Context* context,const AttributeSet&atts,TabLayout*p
//ViewCompat.setPointerIcon(this,PointerIconCompat.getSystemIcon(getContext(), PointerIconCompat.TYPE_HAND));
}
TabLayout::TabView::~TabView(){
delete mTab;
}
bool TabLayout::TabView::performClick(){
bool handled = LinearLayout::performClick();

View File

@ -71,6 +71,7 @@ public:
float approximateLineWidth(Layout* layout, int line, float textSize);
public:
TabView(Context* context,const AttributeSet&atts,TabLayout*parent);
~TabView();
bool performClick()override;
void setSelected(bool selected)override;
void onMeasure(int origWidthMeasureSpec,int origHeightMeasureSpec)override;

View File

@ -624,7 +624,7 @@ void ViewPager::populate(int newCurrentItem){
ii = addNewItem(pos, itemIndex);
itemIndex++;
extraWidthRight += ii->widthFactor;
ii = itemIndex < mItems.size() ? mItems.at(itemIndex) : nullptr;
ii = itemIndex < mItems.size() ? mItems.at(itemIndex) : nullptr;
}
}
}