2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Refactor QPDF::removeObject

Do not remove object from xref table as this is only required when the
the method is called from within QPDF::Xref_table.
This commit is contained in:
m-holger 2024-08-12 17:52:42 +01:00
parent 5fc257f0f7
commit fa03ed3891

View File

@ -760,6 +760,7 @@ QPDF::Xref_table::read(qpdf_offset_t xref_offset)
for (auto const& item: *this) {
auto id = item.first.getObj();
if (id == last_og.getObj() && id > 0) {
erase(last_og);
qpdf.removeObject(last_og);
}
last_og = item.first;
@ -2175,7 +2176,6 @@ QPDF::replaceObject(QPDFObjGen const& og, QPDFObjectHandle oh)
void
QPDF::removeObject(QPDFObjGen og)
{
m->xref_table.erase(og);
if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
// Take care of any object handles that may be floating around.
cached->second.object->assign(QPDF_Null::create());