Commit fa03ed38915c516b4ffd7b46ea68a83ae2e58d63

Authored by m-holger
1 parent 5fc257f0

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.
Showing 1 changed file with 1 additions and 1 deletions
libqpdf/QPDF.cc
... ... @@ -760,6 +760,7 @@ QPDF::Xref_table::read(qpdf_offset_t xref_offset)
760 760 for (auto const& item: *this) {
761 761 auto id = item.first.getObj();
762 762 if (id == last_og.getObj() && id > 0) {
  763 + erase(last_og);
763 764 qpdf.removeObject(last_og);
764 765 }
765 766 last_og = item.first;
... ... @@ -2175,7 +2176,6 @@ QPDF::replaceObject(QPDFObjGen const& og, QPDFObjectHandle oh)
2175 2176 void
2176 2177 QPDF::removeObject(QPDFObjGen og)
2177 2178 {
2178   - m->xref_table.erase(og);
2179 2179 if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
2180 2180 // Take care of any object handles that may be floating around.
2181 2181 cached->second.object->assign(QPDF_Null::create());
... ...