Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Issue 1381073005: SkPDF: ASAN fix: don't double ref new SkPDFBitmap objects (Closed)

Created:
5 years, 2 months ago by hal.canary
Modified:
5 years, 2 months ago
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M src/pdf/SkPDFDevice.cpp View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 10 (4 generated)
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1381073005/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1381073005/1
5 years, 2 months ago (2015-10-01 17:57:39 UTC) #5
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://skia.googlesource.com/skia/+/3d8c33cd835054affab43ac8c96f349147d2e776
5 years, 2 months ago (2015-10-01 18:06:29 UTC) #6
tomhudson
LGTM, but it isn't clear how this is avoiding a double-ref; looks like more of ...
5 years, 2 months ago (2015-10-01 18:24:46 UTC) #7
hal.canary
On 2015/10/01 18:24:46, tomhudson wrote: > LGTM, but it isn't clear how this is avoiding ...
5 years, 2 months ago (2015-10-01 18:33:45 UTC) #8
hal.canary
TODO: make SkPDFObject not refcounted.
5 years, 2 months ago (2015-10-01 18:34:09 UTC) #9
tomhudson
5 years, 2 months ago (2015-10-01 18:43:13 UTC) #10
Message was sent while issue was closed.
Wow, I'd lost track of the length of this function - 140 lines. I wanted to say
"there's no new here", but had to read back a long way to be sure.

On 2015/10/01 18:33:45, Hal Canary wrote:
> On 2015/10/01 18:24:46, tomhudson wrote:
> > LGTM, but it isn't clear how this is avoiding a double-ref; looks like more
of
> a
> > extra-unref fix?
> 
> before I was acting as if `new SkPDFObject` created an object with refcnt 0,
not
> 1.

There's no new here, so I'm still confused.

SkCanon::find*() is presumably always going to return something ref'd (if it
returns nonnull).
If the bitmap isn't found, you're creating it (refcnt 1).
You then pass it to addXObjectResource (which explicitly refs it IFF it hasn't
already been stored as an x-object resource), and autounref it on exit.

It seems safe to assume that it'll only be an XObjectResource if it's already in
the Canon?

Hmm - is this really correct yet?
1. We SkCanon::find*() an object with, say, refcnt 2.
2. addXObjectResource() finds it already in fXObjectResources and so does *NOT*
ref it.
3. autounref on exit decrements the refcnt to 1.

Powered by Google App Engine
This is Rietveld 408576698