Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a1277de3 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android (Google) Code Review
Browse files

Merge "Prevent a memory leak in TextLine." into ics-mr1

parents 1fb90497 c3fb7a11
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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
            }
        }
    }

    /**