mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +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:
parent
5fc257f0f7
commit
fa03ed3891
@ -760,6 +760,7 @@ QPDF::Xref_table::read(qpdf_offset_t xref_offset)
|
|||||||
for (auto const& item: *this) {
|
for (auto const& item: *this) {
|
||||||
auto id = item.first.getObj();
|
auto id = item.first.getObj();
|
||||||
if (id == last_og.getObj() && id > 0) {
|
if (id == last_og.getObj() && id > 0) {
|
||||||
|
erase(last_og);
|
||||||
qpdf.removeObject(last_og);
|
qpdf.removeObject(last_og);
|
||||||
}
|
}
|
||||||
last_og = item.first;
|
last_og = item.first;
|
||||||
@ -2175,7 +2176,6 @@ QPDF::replaceObject(QPDFObjGen const& og, QPDFObjectHandle oh)
|
|||||||
void
|
void
|
||||||
QPDF::removeObject(QPDFObjGen og)
|
QPDF::removeObject(QPDFObjGen og)
|
||||||
{
|
{
|
||||||
m->xref_table.erase(og);
|
|
||||||
if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
|
if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
|
||||||
// Take care of any object handles that may be floating around.
|
// Take care of any object handles that may be floating around.
|
||||||
cached->second.object->assign(QPDF_Null::create());
|
cached->second.object->assign(QPDF_Null::create());
|
||||||
|
Loading…
Reference in New Issue
Block a user