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.
This commit is contained in:
Android (Google) Code Review
2009-06-19 10:07:29 -07:00

View File

@@ -1404,7 +1404,11 @@ public class Canvas {
protected void finalize() throws Throwable {
super.finalize();
finalizer(mNativeCanvas);
// If the constructor threw an exception before setting mNativeCanvas, the native finalizer
// must not be invoked.
if (mNativeCanvas != 0) {
finalizer(mNativeCanvas);
}
}
/**