summaryrefslogtreecommitdiffstats
path: root/core/jni/android/graphics
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-07-30 13:41:10 -0700
committerRaph Levien <raph@google.com>2014-07-30 13:41:10 -0700
commitfebccd05f2e9ad2422d74fcf33ec9bc900ae83bb (patch)
tree317c5de83200b998131b8e7bdb3509769906154f /core/jni/android/graphics
parented1391a9297db5e2a8671bbf2d83654ee5d28702 (diff)
downloadframeworks_base-febccd05f2e9ad2422d74fcf33ec9bc900ae83bb.zip
frameworks_base-febccd05f2e9ad2422d74fcf33ec9bc900ae83bb.tar.gz
frameworks_base-febccd05f2e9ad2422d74fcf33ec9bc900ae83bb.tar.bz2
Bump refcount of canvas created for Picture
Both the Canvas and Picture objects will unref the canvas in their finalizers, so an extra ref is needed. This had been present but was inadvertently removed in the patch "Refactor android.graphics.Picture JNI bindings." This patch simply restores the previous ref and comment. Bug: 16399257 Change-Id: I9911826bd0e668bd25546ef54b0c9c1d467538c8
Diffstat (limited to 'core/jni/android/graphics')
-rw-r--r--core/jni/android/graphics/Picture.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index d214575..630999c 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -42,6 +42,10 @@ Canvas* Picture::beginRecording(int width, int height) {
mWidth = width;
mHeight = height;
SkCanvas* canvas = mRecorder->beginRecording(width, height, NULL, 0);
+ // the java side will wrap this guy in a Canvas.java, which will call
+ // unref in its finalizer, so we have to ref it here, so that both that
+ // Canvas.java and our picture can both be owners
+ canvas->ref();
return Canvas::create_canvas(canvas);
}