aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Dictionary.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDF_Dictionary.cc')
-rw-r--r--libqpdf/QPDF_Dictionary.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/libqpdf/QPDF_Dictionary.cc b/libqpdf/QPDF_Dictionary.cc
index 5b1e03d8..1df4f8f0 100644
--- a/libqpdf/QPDF_Dictionary.cc
+++ b/libqpdf/QPDF_Dictionary.cc
@@ -18,7 +18,17 @@ QPDF_Dictionary::create(std::map<std::string, QPDFObjectHandle> const& items)
std::shared_ptr<QPDFObject>
QPDF_Dictionary::copy(bool shallow)
{
- return create(items);
+ if (shallow) {
+ return create(items);
+ } else {
+ std::map<std::string, QPDFObjectHandle> new_items;
+ for (auto const& item: this->items) {
+ auto value = item.second;
+ new_items[item.first] =
+ value.isIndirect() ? value : value.shallowCopy();
+ }
+ return create(new_items);
+ }
}
void