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

Issue 2353093002: Assert that dictionary can own the objects it is given. (Closed)

Created:
4 years, 3 months ago by Tom Sepez
Modified:
4 years, 3 months ago
Reviewers:
dsinclair
CC:
pdfium-reviews_googlegroups.com
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

Assert that dictionary can own the objects it is given. Upon indirect object holder destruction, all indirect objects are destroyed -- currently by order of increasing object number -- but ideally without ordering constraints. So currently, we can get away with a dictionary pointing directly at an indirect object with a higher number. It gets destroyed first, invoking Release() on its subordinates, which skips destroying them if they are indirect objects. But we don't want to rely on this artifact of destruction order. Should it happen to be reversed, the dictionary would invoke Release() on freed memory. Interestingly, CPDF_Array skirts the issue by replacing any indirect objects it is given with references. Not clear whether we should do the same thing for dictionaries, or remove it from arrays. The technique certainly complicates understanding ownership. The one violation found is in the unittest that broke the previous CL which tried to use unique_ptrs in indirect object holder. Committed: https://pdfium.googlesource.com/pdfium/+/393fe4943226846a9b99878406d0bf75f31bb643

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M core/fpdfdoc/cpdf_formfield_unittest.cpp View 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 18 (14 generated)
Tom Sepez
Dan, for review.
4 years, 3 months ago (2016-09-20 18:08:21 UTC) #7
dsinclair
lgtm
4 years, 3 months ago (2016-09-20 18:12:59 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2353093002/1
4 years, 3 months ago (2016-09-20 18:28:12 UTC) #16
commit-bot: I haz the power
4 years, 3 months ago (2016-09-20 18:28:28 UTC) #18
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://pdfium.googlesource.com/pdfium/+/393fe4943226846a9b99878406d0bf75f31b...

Powered by Google App Engine
This is Rietveld 408576698