diff options
author | Jay Berkenbilt <ejb@ql.org> | 2018-06-22 02:33:38 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2018-06-22 02:34:45 +0200 |
commit | ddd78c1b7f53f09710431d58cd94659271f325cc (patch) | |
tree | 0522d6b1559f7c94f001113f5a5e10bca737e37f /include | |
parent | 84cd53f5af72f8d1da5c6e73ebf7997243bf0b2c (diff) | |
download | qpdf-ddd78c1b7f53f09710431d58cd94659271f325cc.tar.zst |
Fix QPDFObjectHandle::shallowCopy
It's not really a shallow copy. It just doesn't cross indirect object
boundaries. The old implementation had a bug that would cause multiple
shallow copies of the same object to share memory, which was not the
intention.
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDFObjectHandle.hh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 868b5c07..6e45b5fd 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -514,10 +514,11 @@ class QPDFObjectHandle QPDF_DLL QPDF* getOwningQPDF(); - // Create a shallow copy of an object as a direct object. Since - // this is a shallow copy, for dictionaries and arrays, any keys - // or items that were indirect objects will still be indirect - // objects that point to the same place. + // Create a shallow of an object as a direct object, but do not + // traverse across indirect object boundaries. That means that, + // for dictionaries and arrays, any keys or items that were + // indirect objects will still be indirect objects that point to + // the same place. QPDF_DLL QPDFObjectHandle shallowCopy(); @@ -880,7 +881,7 @@ class QPDFObjectHandle void objectWarning(std::string const& warning); void assertType(char const* type_name, bool istype); void dereference(); - void makeDirectInternal(std::set<int>& visited); + void copyObject(std::set<QPDFObjGen>& visited, bool cross_indirect); void releaseResolved(); static void setObjectDescriptionFromInput( QPDFObjectHandle, QPDF*, std::string const&, |