Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit febccd05 authored by Raph Levien's avatar Raph Levien
Browse files

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
parent ed1391a9
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,10 @@ Canvas* Picture::beginRecording(int width, int height) {
    mWidth = width;
    mWidth = width;
    mHeight = height;
    mHeight = height;
    SkCanvas* canvas = mRecorder->beginRecording(width, height, NULL, 0);
    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);
    return Canvas::create_canvas(canvas);
}
}