Commit 4bc434000c42a7191e705c8a38216ca6743ad9ff

Authored by Jay Berkenbilt
1 parent aad2b108

Copy subdictionaries when removing resources (fixes #276)

When removing unreferenced resources, the code was copying the overall
resource dictionaries but not the subdictionaries being modified. This
was a "typo" in the code -- the comment clearly stated the need to do
this, but the code replaced the dictionary with itself rather than
with a shallow copy of itself.
libqpdf/QPDFPageObjectHelper.cc
@@ -156,6 +156,7 @@ QPDFPageObjectHelper::removeUnreferencedResources() @@ -156,6 +156,7 @@ QPDFPageObjectHelper::removeUnreferencedResources()
156 { 156 {
157 continue; 157 continue;
158 } 158 }
  159 + dict = dict.shallowCopy();
159 resources.replaceKey(*d_iter, dict); 160 resources.replaceKey(*d_iter, dict);
160 std::set<std::string> keys = dict.getKeys(); 161 std::set<std::string> keys = dict.getKeys();
161 for (std::set<std::string>::iterator k_iter = keys.begin(); 162 for (std::set<std::string>::iterator k_iter = keys.begin();