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

Commit adf62b3e authored by Diego Perez's avatar Diego Perez
Browse files

Do not deallocate on Bitmap.recycle

Layoutlib only disposes the bitmap and doesn't recycle them. This causes
a double deallocation that triggers an assertion.
This change makes Bitmaps to be only freed when the finalizer is called.

Bug: http://b.android.com/203129
Change-Id: Ieabc1443544cfd2b4bf8ba9c8f9a4df8dd6e8220
parent 497b473b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ public final class Bitmap_Delegate {

    // ---- delegate manager ----
    private static final DelegateManager<Bitmap_Delegate> sManager =
            new DelegateManager<Bitmap_Delegate>(Bitmap_Delegate.class);
            new DelegateManager<>(Bitmap_Delegate.class);
    private static long sFinalizer = -1;

    // ---- delegate helper data ----
@@ -314,7 +314,7 @@ public final class Bitmap_Delegate {

    @LayoutlibDelegate
    /*package*/ static boolean nativeRecycle(long nativeBitmap) {
        sManager.removeJavaReferenceFor(nativeBitmap);
        // In our case reycle() is a no-op. We will let the finalizer to dispose the bitmap.
        return true;
    }