Merge "Prevent a memory leak in TextLine." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
a1277de3c3
@@ -102,6 +102,11 @@ class TextLine {
|
||||
tl.mText = null;
|
||||
tl.mPaint = null;
|
||||
tl.mDirections = null;
|
||||
|
||||
tl.mMetricAffectingSpanSpanSet.recycle();
|
||||
tl.mCharacterStyleSpanSet.recycle();
|
||||
tl.mReplacementSpanSpanSet.recycle();
|
||||
|
||||
synchronized(sCached) {
|
||||
for (int i = 0; i < sCached.length; ++i) {
|
||||
if (sCached[i] == null) {
|
||||
@@ -919,6 +924,12 @@ class TextLine {
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void recycle() {
|
||||
for (int i = 0; i < numberOfSpans; i++) {
|
||||
spans[i] = null; // prevent a leak: no reference kept when TextLine is recycled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user