mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-12-02 12:17:46 +08:00
fix some memleak
This commit is contained in:
parent
937d82c781
commit
30298fbc57
@ -19,13 +19,17 @@ public:
|
||||
template<typename T>
|
||||
class SimplePool:public Pool<T>{
|
||||
private:
|
||||
int maxPoolSize;
|
||||
std::vector<T*> mPool;
|
||||
int maxPoolSize;
|
||||
std::vector<T*> mPool;
|
||||
public:
|
||||
SimplePool(int maxPoolSize) {
|
||||
SimplePool(int maxPoolSize) {
|
||||
LOGE_IF(maxPoolSize <= 0,"The max pool size must be > 0");
|
||||
this->maxPoolSize = maxPoolSize;
|
||||
for(int i=0;i<maxPoolSize;i++)mPool.push_back(new T());
|
||||
this->maxPoolSize = maxPoolSize;
|
||||
for(int i=0;i<maxPoolSize;i++)mPool.push_back(new T());
|
||||
}
|
||||
~SimplePool(){
|
||||
for(int i=0;i<maxPoolSize;i++)delete mPool.at(i);
|
||||
mPool.clear();
|
||||
}
|
||||
T* acquire() {
|
||||
if (!mPool.empty()) {
|
||||
|
@ -8,7 +8,7 @@ GridLayoutManager::GridLayoutManager(Context* context,const AttributeSet& attrs)
|
||||
Properties* properties = getProperties(context, attrs,0,0);// defStyleAttr, defStyleRes);
|
||||
mSpanSizeLookup = new DefaultSpanSizeLookup();
|
||||
setSpanCount(properties->spanCount);
|
||||
delete properties;
|
||||
delete properties;
|
||||
}
|
||||
|
||||
GridLayoutManager::GridLayoutManager(Context* context, int spanCount)
|
||||
|
@ -27,6 +27,7 @@ LinearLayoutManager::LinearLayoutManager(Context* context, const AttributeSet& a
|
||||
setOrientation(properties->orientation);
|
||||
setReverseLayout(properties->reverseLayout);
|
||||
setStackFromEnd(properties->stackFromEnd);
|
||||
delete properties;
|
||||
}
|
||||
|
||||
LinearLayoutManager::~LinearLayoutManager(){
|
||||
|
@ -67,11 +67,11 @@ RecyclerView::RecyclerView(int w,int h):ViewGroup(w,h){
|
||||
RecyclerView::RecyclerView(Context* context,const AttributeSet& attrs)
|
||||
:ViewGroup(context, attrs){
|
||||
|
||||
mClipToPadding = attrs.getBoolean("clipToPadding", true);
|
||||
initRecyclerView();
|
||||
initAdapterManager();
|
||||
initChildrenHelper();
|
||||
initAutofill();
|
||||
mClipToPadding = attrs.getBoolean("clipToPadding", true);
|
||||
// If not explicitly specified this view is important for accessibility.
|
||||
if (getImportantForAccessibility()
|
||||
== View::IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
|
||||
@ -128,6 +128,7 @@ void RecyclerView::initRecyclerView(){
|
||||
mIsAttached = false;
|
||||
mHasFixedSize = true;
|
||||
mEnableFastScroller = false;
|
||||
mClipToPadding = true;
|
||||
mIgnoreMotionEventTillDown = false;
|
||||
mPostedAnimatorRunner = false;
|
||||
mDataSetHasChangedAfterLayout = false;
|
||||
|
@ -17,6 +17,7 @@ StaggeredGridLayoutManager::StaggeredGridLayoutManager(Context* context,const At
|
||||
setSpanCount(properties->spanCount);
|
||||
setReverseLayout(properties->reverseLayout);
|
||||
createOrientationHelpers();
|
||||
delete properties;
|
||||
}
|
||||
|
||||
StaggeredGridLayoutManager::StaggeredGridLayoutManager(int spanCount, int orientation) {
|
||||
|
Loading…
Reference in New Issue
Block a user