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

Commit 22ba7869 authored by Raph Levien's avatar Raph Levien
Browse files

Release text when finishing StaticLayout.Builder

DynamicLayout reuses a StaticLayout.Builder object to avoid having to
allocate. There is a "finish" method that releases any expensive
internal state of the builder object, but it didn't release a
reference to the text object (which in turn may contain references to
lots of other things, especially if it's a Spannable).

This patch releases the text, as well as a few other arrays, at time
of finish.

Bug: 22822416
Change-Id: Icc8b6cd41a9a2d11689df7bd1b9f524c6524f706
parent 9c450936
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ public class StaticLayout extends Layout {
        // release any expensive state
        /* package */ void finish() {
            nFinishBuilder(mNativePtr);
            mText = null;
            mPaint = null;
            mLeftIndents = null;
            mRightIndents = null;
            mMeasuredText.finish();
        }