Commit 08d7b56746a93c25db2991403fec7e56cbae132d
1 parent
7e77af35
Prevent destruction of shared null objects
#863 uses a single null object for nulls that were previously implicit. In certain circumstances this shared null object gets destroyed (i.e changed to a QPDF_Destroyed object) when a QPDF object is destroyed. Modify the QPDF destructor so that null objects get disconnected from the dying QPDF object but not destroyed to prevent this from happening.
Showing
1 changed file
with
3 additions
and
2 deletions
libqpdf/QPDF.cc
| ... | ... | @@ -247,10 +247,11 @@ QPDF::~QPDF() |
| 247 | 247 | // but we'll explicitly clear the xref table anyway just to |
| 248 | 248 | // prevent any possibility of resolve() succeeding. |
| 249 | 249 | this->m->xref_table.clear(); |
| 250 | - auto null_obj = QPDF_Null::create(); | |
| 251 | 250 | for (auto const& iter: this->m->obj_cache) { |
| 252 | 251 | iter.second.object->disconnect(); |
| 253 | - iter.second.object->destroy(); | |
| 252 | + if (iter.second.object->getTypeCode() != ::ot_null) { | |
| 253 | + iter.second.object->destroy(); | |
| 254 | + } | |
| 254 | 255 | } |
| 255 | 256 | } |
| 256 | 257 | ... | ... |