Fix Canvas.finalize() for the case where the constructor throws an exception
before the native canvas instance was created.

If the canvas constructors throw an exception (because the bitmap passed in is
immutable or already recycled), the constructor terminates early without
allocating the native canvas instance. For the most part, that's okay, since
the Canvas instance will never be returned to the application.  However, the GC
will still call finalize() on the half-initialized Canvas.

The native methods for Canvas all assume that the canvas pointer passed down is
not null.
1 file changed