diff options
author | tsepez <tsepez@chromium.org> | 2016-09-20 11:28:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-20 11:28:25 -0700 |
commit | 393fe4943226846a9b99878406d0bf75f31bb643 (patch) | |
tree | 1a70376a4c9caf54fe309782877d9f3033b51cb6 /fpdfsdk/cpdfsdk_annot.cpp | |
parent | 9972ff99285cea12a20026136e98c1e635a15010 (diff) | |
download | pdfium-393fe4943226846a9b99878406d0bf75f31bb643.tar.xz |
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.
Review-Url: https://codereview.chromium.org/2353093002
Diffstat (limited to 'fpdfsdk/cpdfsdk_annot.cpp')
0 files changed, 0 insertions, 0 deletions