Commit c6872d2c700a9d27105debe93662ecaaf8beb3bd
1 parent
c16aa1ac
Clean up circular references in QPDF_Stream
Showing
3 changed files
with
11 additions
and
0 deletions
include/qpdf/QPDFObjectHandle.hh
| @@ -597,6 +597,7 @@ class QPDFObjectHandle | @@ -597,6 +597,7 @@ class QPDFObjectHandle | ||
| 597 | { | 597 | { |
| 598 | friend class QPDF_Dictionary; | 598 | friend class QPDF_Dictionary; |
| 599 | friend class QPDF_Array; | 599 | friend class QPDF_Array; |
| 600 | + friend class QPDF_Stream; | ||
| 600 | private: | 601 | private: |
| 601 | static void releaseResolved(QPDFObjectHandle& o) | 602 | static void releaseResolved(QPDFObjectHandle& o) |
| 602 | { | 603 | { |
libqpdf/QPDF_Stream.cc
| @@ -45,6 +45,13 @@ QPDF_Stream::~QPDF_Stream() | @@ -45,6 +45,13 @@ QPDF_Stream::~QPDF_Stream() | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void | 47 | void |
| 48 | +QPDF_Stream::releaseResolved() | ||
| 49 | +{ | ||
| 50 | + this->stream_provider = 0; | ||
| 51 | + QPDFObjectHandle::ReleaseResolver::releaseResolved(this->stream_dict); | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +void | ||
| 48 | QPDF_Stream::setObjGen(int objid, int generation) | 55 | QPDF_Stream::setObjGen(int objid, int generation) |
| 49 | { | 56 | { |
| 50 | if (! ((this->objid == 0) && (this->generation == 0))) | 57 | if (! ((this->objid == 0) && (this->generation == 0))) |
libqpdf/qpdf/QPDF_Stream.hh
| @@ -43,6 +43,9 @@ class QPDF_Stream: public QPDFObject | @@ -43,6 +43,9 @@ class QPDF_Stream: public QPDFObject | ||
| 43 | // when adding streams to files. | 43 | // when adding streams to files. |
| 44 | void setObjGen(int objid, int generation); | 44 | void setObjGen(int objid, int generation); |
| 45 | 45 | ||
| 46 | + protected: | ||
| 47 | + virtual void releaseResolved(); | ||
| 48 | + | ||
| 46 | private: | 49 | private: |
| 47 | static std::map<std::string, std::string> filter_abbreviations; | 50 | static std::map<std::string, std::string> filter_abbreviations; |
| 48 | 51 |