aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-08 17:06:15 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-08 17:06:15 +0200
commitc7a4967d10fb9688f235baa8e57a1fb578f5387d (patch)
treeb14956a2371befbd30b2a43583c390bc170ccd3d /libqpdf/QPDF.cc
parentdba61da1bfb7e4d74c723f369d1c017df9707a14 (diff)
downloadqpdf-c7a4967d10fb9688f235baa8e57a1fb578f5387d.tar.zst
Change reset to disconnect and clarify comments
I decided that it's actually fine to copy a direct object to another QPDF. Even if we eventually prevent a QPDFObject from having multiple parents, this could happen if an object is moved.
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index c66cfd5a..1b1ee784 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -252,9 +252,11 @@ QPDF::~QPDF()
// resolved indirect references by replacing them with an internal
// object type representing that they have been destroyed. Note
// that we can't break references like this at any time when the
- // QPDF object is active. The call to reset also causes all
+ // QPDF object is active. The call to reset also causes all direct
// QPDFObjectHandle objects that are reachable from this object to
- // release their association with this QPDF.
+ // release their association with this QPDF. Direct objects are
+ // not destroyed since they can be moved to other QPDF objects
+ // safely.
// At this point, obviously no one is still using the QPDF object,
// but we'll explicitly clear the xref table anyway just to
@@ -262,9 +264,7 @@ QPDF::~QPDF()
this->m->xref_table.clear();
auto null_obj = QPDF_Null::create();
for (auto const& iter: this->m->obj_cache) {
- iter.second.object->reset();
- // It would be better if reset() could call destroy(), but it
- // can't -- see comments in QPDFValueProxy::reset().
+ iter.second.object->disconnect();
iter.second.object->destroy();
}
}