diff options
| author | 2016-05-03 13:06:22 -0700 | |
|---|---|---|
| committer | 2016-05-03 13:06:22 -0700 | |
| commit | 0ebdbb4a8470bb77f38c33a42c220ecb8a7adcc6 (patch) | |
| tree | 56e3327e36417761615ce3bb9479528bdbdf5bf3 | |
| parent | a2c10caef20bbdb447844c09a822073fd0c9d62f (diff) | |
Hold a ClassLoader reference in NativeAllocationRegistry.
So that the native library isn't unloaded before we have a chance to
call the freeFunction.
Bug: 28406866
Change-Id: I889f1ccd91bba70e31fb8d09c0ec6d471fc35841
| -rw-r--r-- | graphics/java/android/graphics/Bitmap.java | 2 | ||||
| -rw-r--r-- | graphics/java/android/graphics/Canvas.java | 2 | ||||
| -rw-r--r-- | graphics/java/android/graphics/Paint.java | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java index ac2a88a17f0b..1fdc1f575bd4 100644 --- a/graphics/java/android/graphics/Bitmap.java +++ b/graphics/java/android/graphics/Bitmap.java @@ -133,7 +133,7 @@ public final class Bitmap implements Parcelable { nativeSize += getByteCount(); } NativeAllocationRegistry registry = new NativeAllocationRegistry( - nativeGetNativeFinalizer(), nativeSize); + Bitmap.class.getClassLoader(), nativeGetNativeFinalizer(), nativeSize); registry.registerNativeAllocation(this, nativeBitmap); } diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index c65880b2fcce..cb6c92e87172 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -94,7 +94,7 @@ public class Canvas { // Use a Holder to allow static initialization of Canvas in the boot image. private static class NoImagePreloadHolder { public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry( - getNativeFinalizer(), NATIVE_ALLOCATION_SIZE); + Canvas.class.getClassLoader(), getNativeFinalizer(), NATIVE_ALLOCATION_SIZE); } // This field is used to finalize the native Canvas properly diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index 0dae7961ff20..daa1d7c6648f 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -47,7 +47,7 @@ public class Paint { // Use a Holder to allow static initialization of Paint in the boot image. private static class NoImagePreloadHolder { public static final NativeAllocationRegistry sRegistry = new NativeAllocationRegistry( - nGetNativeFinalizer(), NATIVE_PAINT_SIZE); + Paint.class.getClassLoader(), nGetNativeFinalizer(), NATIVE_PAINT_SIZE); } /** |