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:
@@ -1404,8 +1404,12 @@ public class Canvas {
|
|||||||
|
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
|
// If the constructor threw an exception before setting mNativeCanvas, the native finalizer
|
||||||
|
// must not be invoked.
|
||||||
|
if (mNativeCanvas != 0) {
|
||||||
finalizer(mNativeCanvas);
|
finalizer(mNativeCanvas);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free up as much memory as possible from private caches (e.g. fonts,
|
* Free up as much memory as possible from private caches (e.g. fonts,
|
||||||
|
|||||||
Reference in New Issue
Block a user