aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-09-04 01:58:53 +0200
committerm-holger <m-holger@kubitscheck.org>2022-09-04 11:41:18 +0200
commit9c86ba40d80ee3b58801dfe77e47fbc5a9dd6066 (patch)
treea438e346b4e124ba8babdec1effca4f8b9386a7d /libqpdf/QPDF.cc
parent6d2db68f2ecd1f8b0945bc982af7a9807436d881 (diff)
downloadqpdf-9c86ba40d80ee3b58801dfe77e47fbc5a9dd6066.tar.zst
Fix commit 805c1ad : Reset QPDFValue::qpdf and QPDFValue::og when ...
On destruction of the QPDF object replace all indirect object references with direct nulls. Remove all existing code to release resolved references. Fixes performance issue due to interaction of resetting QPDFValue::qpdf and og members and prior code.
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 49a33633..15636d34 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -249,17 +249,16 @@ QPDF::~QPDF()
// std::shared_ptr objects will prevent the objects from being
// deleted. Walk through all objects in the object cache, which
// is those objects that we read from the file, and break all
- // resolved references. At this point, obviously no one is still
+ // resolved indirect references by replacing them with direct
+ // null objects. At this point, obviously no one is still
// using the QPDF object, but we'll explicitly clear the xref
// table anyway just to prevent any possibility of resolve()
// succeeding. Note that we can't break references like this at
- // any time when the QPDF object is active. If we do, the next
- // reference will reread the object from the file, which would
- // have the effect of undoing any modifications that may have been
- // made to any of the objects.
+ // any time when the QPDF object is active.
this->m->xref_table.clear();
+ auto null_obj = QPDF_Null::create();
for (auto const& iter: this->m->obj_cache) {
- iter.second.object->releaseResolved();
+ iter.second.object->assign(null_obj);
iter.second.object->resetObjGen();
}
}