summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-05-05 16:08:07 -0700
committerRaph Levien <raph@google.com>2014-05-12 10:41:43 -0700
commit15cf4757dc0099301662f8a26da561434cc07cfa (patch)
tree3324728c5fa71e1823e2bc2b9383a38f6bbe0218 /graphics
parent9a5b61ccc83303ceeec2059f58c1977af9faa9e3 (diff)
downloadframeworks_base-15cf4757dc0099301662f8a26da561434cc07cfa.zip
frameworks_base-15cf4757dc0099301662f8a26da561434cc07cfa.tar.gz
frameworks_base-15cf4757dc0099301662f8a26da561434cc07cfa.tar.bz2
Proper refcounting for Minikin objects
This patch introduces proper lifecycle maintenance (based on reference counting) for Minkin objects, particularly FontFamily and FontCollection. The patch depends on the corresponding Ref and Unref methods being available in Minikin. Change-Id: I91935e953d5a522e1adc496f2ce3a598be35de2b
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/FontFamily.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/FontFamily.java b/graphics/java/android/graphics/FontFamily.java
index 7c55ae8..a759a79 100644
--- a/graphics/java/android/graphics/FontFamily.java
+++ b/graphics/java/android/graphics/FontFamily.java
@@ -36,13 +36,21 @@ public class FontFamily {
throw new RuntimeException();
}
}
- // TODO: finalization
+
+ @Override
+ protected void finalize() throws Throwable {
+ try {
+ nUnrefFamily(mNativePtr);
+ } finally {
+ super.finalize();
+ }
+ }
public boolean addFont(File path) {
return nAddFont(mNativePtr, path.getAbsolutePath());
}
static native long nCreateFamily();
- static native void nDestroyFamily(long nativePtr);
+ static native void nUnrefFamily(long nativePtr);
static native boolean nAddFont(long nativeFamily, String path);
}