Commit 892937cbbeeef612da9e8b8a4b5ba145fc1e6caa
1 parent
1e629c27
Fix errors in --remove-unreferenced-resources=auto
Showing
2 changed files
with
4 additions
and
2 deletions
qpdf/qpdf.cc
| @@ -4846,13 +4846,13 @@ static bool should_remove_unreferenced_resources(QPDF& pdf, Options& o) | @@ -4846,13 +4846,13 @@ static bool should_remove_unreferenced_resources(QPDF& pdf, Options& o) | ||
| 4846 | while (! queue.empty()) | 4846 | while (! queue.empty()) |
| 4847 | { | 4847 | { |
| 4848 | QPDFObjectHandle node = *queue.begin(); | 4848 | QPDFObjectHandle node = *queue.begin(); |
| 4849 | + queue.pop_front(); | ||
| 4849 | QPDFObjGen og = node.getObjGen(); | 4850 | QPDFObjGen og = node.getObjGen(); |
| 4850 | if (nodes_seen.count(og)) | 4851 | if (nodes_seen.count(og)) |
| 4851 | { | 4852 | { |
| 4852 | continue; | 4853 | continue; |
| 4853 | } | 4854 | } |
| 4854 | nodes_seen.insert(og); | 4855 | nodes_seen.insert(og); |
| 4855 | - queue.pop_front(); | ||
| 4856 | QPDFObjectHandle dict = node.isStream() ? node.getDict() : node; | 4856 | QPDFObjectHandle dict = node.isStream() ? node.getDict() : node; |
| 4857 | QPDFObjectHandle kids = dict.getKey("/Kids"); | 4857 | QPDFObjectHandle kids = dict.getKey("/Kids"); |
| 4858 | if (kids.isArray()) | 4858 | if (kids.isArray()) |
| @@ -4898,7 +4898,9 @@ static bool should_remove_unreferenced_resources(QPDF& pdf, Options& o) | @@ -4898,7 +4898,9 @@ static bool should_remove_unreferenced_resources(QPDF& pdf, Options& o) | ||
| 4898 | } | 4898 | } |
| 4899 | resources_seen.insert(resources_og); | 4899 | resources_seen.insert(resources_og); |
| 4900 | } | 4900 | } |
| 4901 | - QPDFObjectHandle xobject = resources.getKey("/XObject"); | 4901 | + QPDFObjectHandle xobject = (resources.isDictionary() ? |
| 4902 | + resources.getKey("/XObject") : | ||
| 4903 | + QPDFObjectHandle::newNull()); | ||
| 4902 | if (xobject.isIndirect()) | 4904 | if (xobject.isIndirect()) |
| 4903 | { | 4905 | { |
| 4904 | QPDFObjGen xobject_og = xobject.getObjGen(); | 4906 | QPDFObjGen xobject_og = xobject.getObjGen(); |
qpdf/qtest/qpdf/shared-form-images-xobject.pdf
No preview for this file type