diff options
author | Kimiyoshi Kusaka <kusaka.kimiyoshi@sharp.co.jp> | 2011-03-28 11:58:51 +0900 |
---|---|---|
committer | Kimiyoshi Kusaka <kusaka.kimiyoshi@sharp.co.jp> | 2011-03-28 11:58:51 +0900 |
commit | 08d7778f081aae745e6ad9e5350221b21dbf352e (patch) | |
tree | 28ee2d98593ff771eaf89b2916cc0b9e344bf90d /graphics | |
parent | 2e383bc6445b37d3b37fbc5b7620cd4716c5692c (diff) | |
download | frameworks_base-08d7778f081aae745e6ad9e5350221b21dbf352e.zip frameworks_base-08d7778f081aae745e6ad9e5350221b21dbf352e.tar.gz frameworks_base-08d7778f081aae745e6ad9e5350221b21dbf352e.tar.bz2 |
Fix memory leak of SkMovie class
Movie class doesn't have finalize method.
So memory leak of SkMovie class of native Skia occurs when Movie class is released.
I add finalize method to Movie class (Movie.java) and jni destructor method to SkMovie class (Movie.cpp).
Change-Id: I4dae9dd95f128cbfade50bef978b219ba99321dd
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/Movie.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Movie.java b/graphics/java/android/graphics/Movie.java index 95e9946..4a33453 100644 --- a/graphics/java/android/graphics/Movie.java +++ b/graphics/java/android/graphics/Movie.java @@ -46,6 +46,8 @@ public class Movie { public static native Movie decodeByteArray(byte[] data, int offset, int length); + private static native void nativeDestructor(int nativeMovie); + public static Movie decodeFile(String pathName) { InputStream is; try { @@ -57,6 +59,15 @@ public class Movie { return decodeTempStream(is); } + @Override + protected void finalize() throws Throwable { + try { + nativeDestructor(mNativeMovie); + } finally { + super.finalize(); + } + } + private static Movie decodeTempStream(InputStream is) { Movie moov = null; try { |