Merge "Fix memory leak of SkMovie class"

This commit is contained in:
Conley Owens
2011-04-29 10:00:00 -07:00
committed by Android Code Review
2 changed files with 16 additions and 0 deletions

View File

@@ -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 {