summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}