| Index: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| index 67ea4fee658ed59a243013e3111a6ffaf1b63ec9..467ef9b3f6853e6474b8d158818a95cf93f4a33c 100644
|
| --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
|
| @@ -83,6 +83,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatt
|
| for (int i = 0; i < 4; i ++) {
|
| m_pFunctions[i] = NULL;
|
| }
|
| + m_pCountedCS = NULL;
|
| }
|
| CPDF_ShadingPattern::~CPDF_ShadingPattern()
|
| {
|
| @@ -96,12 +97,13 @@ void CPDF_ShadingPattern::Clear()
|
| }
|
| m_pFunctions[i] = NULL;
|
| }
|
| - CPDF_ColorSpace* pCS = m_pCS;
|
| - if (!m_bForceClear && pCS && m_pDocument) {
|
| + CPDF_ColorSpace* pCS = m_pCountedCS ? m_pCountedCS->m_Obj : NULL;
|
| + if (pCS && m_pDocument) {
|
| m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray());
|
| }
|
| m_ShadingType = 0;
|
| m_pCS = NULL;
|
| + m_pCountedCS = NULL;
|
| m_nFuncs = 0;
|
| }
|
| FX_BOOL CPDF_ShadingPattern::Load()
|
| @@ -141,6 +143,9 @@ FX_BOOL CPDF_ShadingPattern::Load()
|
| }
|
| CPDF_DocPageData* pDocPageData = m_pDocument->GetPageData();
|
| m_pCS = pDocPageData->GetColorSpace(pCSObj, NULL);
|
| + if (m_pCS) {
|
| + m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
|
| + }
|
| m_ShadingType = pShadingDict->GetInteger(FX_BSTRC("ShadingType"));
|
| return TRUE;
|
| }
|
|
|