| Index: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
|
| diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
|
| index 8a58d6327c7b13b08a9862c1541caee22578bdd8..fa242ffb857f0c74801dba1fc6f205845aba7566 100644
|
| --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
|
| +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
|
| @@ -214,10 +214,9 @@
|
| return;
|
|
|
| pFontData->RemoveRef();
|
| - if (pFontData->use_count() > 1)
|
| - return;
|
| -
|
| - // We have font data only in m_FontMap cache. Clean it.
|
| + if (pFontData->use_count() != 0)
|
| + return;
|
| +
|
| pFontData->clear();
|
| }
|
|
|
| @@ -331,10 +330,9 @@
|
| return;
|
|
|
| pCountedColorSpace->RemoveRef();
|
| - if (pCountedColorSpace->use_count() > 1)
|
| - return;
|
| -
|
| - // We have item only in m_ColorSpaceMap cache. Clean it.
|
| + if (pCountedColorSpace->use_count() != 0)
|
| + return;
|
| +
|
| pCountedColorSpace->get()->ReleaseCS();
|
| pCountedColorSpace->reset(nullptr);
|
| }
|
| @@ -393,10 +391,9 @@
|
| return;
|
|
|
| pPattern->RemoveRef();
|
| - if (pPattern->use_count() > 1)
|
| - return;
|
| -
|
| - // We have item only in m_PatternMap cache. Clean it.
|
| + if (pPattern->use_count() != 0)
|
| + return;
|
| +
|
| pPattern->clear();
|
| }
|
|
|
| @@ -432,10 +429,9 @@
|
| return;
|
|
|
| pCountedImage->RemoveRef();
|
| - if (pCountedImage->use_count() > 1)
|
| - return;
|
| -
|
| - // We have item only in m_ImageMap cache. Clean it.
|
| + if (pCountedImage->use_count() != 0)
|
| + return;
|
| +
|
| delete pCountedImage->get();
|
| delete pCountedImage;
|
| m_ImageMap.erase(it);
|
| @@ -458,8 +454,7 @@
|
| auto hash_it = m_HashProfileMap.find(bsDigest);
|
| if (hash_it != m_HashProfileMap.end()) {
|
| auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
|
| - if (it_copied_stream != m_IccProfileMap.end())
|
| - return it_copied_stream->second->AddRef();
|
| + return it_copied_stream->second->AddRef();
|
| }
|
| CPDF_IccProfile* pProfile =
|
| new CPDF_IccProfile(stream.GetData(), stream.GetSize());
|
| @@ -478,8 +473,7 @@
|
| continue;
|
|
|
| profile->RemoveRef();
|
| - if (profile->use_count() == 1) {
|
| - // We have item only in m_IccProfileMap cache. Clean it.
|
| + if (profile->use_count() == 0) {
|
| delete profile->get();
|
| delete profile;
|
| m_IccProfileMap.erase(it);
|
| @@ -524,10 +518,9 @@
|
| return;
|
|
|
| pCountedStream->RemoveRef();
|
| - if (pCountedStream->use_count() > 1)
|
| - return;
|
| -
|
| - // We have item only in m_FontFileMap cache. Clean it.
|
| + if (pCountedStream->use_count() != 0)
|
| + return;
|
| +
|
| delete pCountedStream->get();
|
| delete pCountedStream;
|
| m_FontFileMap.erase(it);
|
|
|