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

Commit 2b1aed10 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 4527 into donut

* changes:
  Fix Canvas.finalize() for the case where the constructor throws an exception before the native canvas instance was created.
parents 649f99e8 4566b797
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1404,8 +1404,12 @@ public class Canvas {
    
    protected void finalize() throws Throwable {
        super.finalize();
        // If the constructor threw an exception before setting mNativeCanvas, the native finalizer
        // must not be invoked.
        if (mNativeCanvas != 0) {
            finalizer(mNativeCanvas);
        }
    }

    /**
     * Free up as much memory as possible from private caches (e.g. fonts,