Index: core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp |
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp |
index 78b88a1b2f1a84027057b72047a41b871f4fd162..0613c0d7819327498a16ad3133e2f1a26339cfc5 100644 |
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp |
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp |
@@ -44,10 +44,21 @@ const CPDF_Dictionary* CPDF_Dictionary::AsDictionary() const { |
return this; |
} |
-CPDF_Object* CPDF_Dictionary::Clone(FX_BOOL bDirect) const { |
+CPDF_Object* CPDF_Dictionary::Clone() const { |
+ return CloneDeRef(false); |
+} |
+ |
+CPDF_Object* CPDF_Dictionary::CloneWithCheck( |
+ bool bDirect, |
+ std::set<const CPDF_Object*>* pVisited) const { |
+ pVisited->insert(this); |
CPDF_Dictionary* pCopy = new CPDF_Dictionary(); |
- for (const auto& it : *this) |
- pCopy->m_Map.insert(std::make_pair(it.first, it.second->Clone(bDirect))); |
+ for (const auto& it : *this) { |
+ auto value = it.second; |
Lei Zhang
2016/08/18 15:16:44
auto* ?
Wei Li
2016/08/18 22:02:30
Changed to actual type
|
+ if (!pdfium::ContainsKey(*pVisited, value)) |
dsinclair
2016/08/18 14:04:31
nit: add {}'s
Wei Li
2016/08/18 22:02:30
Done.
|
+ pCopy->m_Map.insert( |
+ std::make_pair(it.first, value->CloneWithCheck(bDirect, pVisited))); |
+ } |
return pCopy; |
} |