aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFWriter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r--libqpdf/QPDFWriter.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc
index 9f3eacbe..d06a82b0 100644
--- a/libqpdf/QPDFWriter.cc
+++ b/libqpdf/QPDFWriter.cc
@@ -1662,8 +1662,8 @@ QPDFWriter::unparseObject(
"qpdf",
"QPDFWriter create Extensions",
this->m->qdf_mode ? 0 : 1);
- extensions = QPDFObjectHandle::newDictionary();
- object.replaceKey("/Extensions", extensions);
+ extensions = object.replaceKeyAndGet(
+ "/Extensions", QPDFObjectHandle::newDictionary());
}
} else if (!have_extensions_other) {
// We have Extensions dictionary and don't want one.
@@ -2387,8 +2387,7 @@ QPDFWriter::prepareFileForWrite()
if (oh.isIndirect()) {
QTC::TC("qpdf", "QPDFWriter make Extensions direct");
extensions_indirect = true;
- oh = oh.shallowCopy();
- root.replaceKey(key, oh);
+ oh = root.replaceKeyAndGet(key, oh.shallowCopy());
}
if (oh.hasKey("/ADBE")) {
QPDFObjectHandle adbe = oh.getKey("/ADBE");