From dba61da1bfb7e4d74c723f369d1c017df9707a14 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 8 Sep 2022 08:03:57 -0400 Subject: Create a special "destroyed" type rather than using null When a QPDF is destroyed, changing indirect objects to direct nulls makes them effectively disappear silently when they sneak into other places. Instead, we should treat this as an error. Adding a destroyed object type makes this possible. --- libqpdf/QPDFValueProxy.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libqpdf/QPDFValueProxy.cc') diff --git a/libqpdf/QPDFValueProxy.cc b/libqpdf/QPDFValueProxy.cc index 461d8177..befaaf8b 100644 --- a/libqpdf/QPDFValueProxy.cc +++ b/libqpdf/QPDFValueProxy.cc @@ -1,6 +1,7 @@ #include #include +#include void QPDFValueProxy::doResolve() @@ -8,3 +9,10 @@ QPDFValueProxy::doResolve() auto og = value->og; QPDF::Resolver::resolve(value->qpdf, og); } + +void +QPDFValueProxy::destroy() +{ + // See comments in reset() for why this isn't part of reset. + value = QPDF_Destroyed::getInstance(); +} -- cgit v1.2.3-70-g09d2