summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_generalstate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page/cpdf_generalstate.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index dd5c5af878..513e5ff7a5 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -124,12 +124,13 @@ void CPDF_GeneralState::SetTR(CPDF_Object* pObject) {
m_Ref.GetPrivateCopy()->m_pTR = pObject;
}
-CPDF_TransferFunc* CPDF_GeneralState::GetTransferFunc() const {
+CFX_RetainPtr<CPDF_TransferFunc> CPDF_GeneralState::GetTransferFunc() const {
const StateData* pData = m_Ref.GetObject();
return pData ? pData->m_pTransferFunc : nullptr;
}
-void CPDF_GeneralState::SetTransferFunc(CPDF_TransferFunc* pFunc) {
+void CPDF_GeneralState::SetTransferFunc(
+ const CFX_RetainPtr<CPDF_TransferFunc>& pFunc) {
m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc;
}
@@ -277,7 +278,9 @@ CPDF_GeneralState::StateData::StateData(const StateData& that)
CPDF_GeneralState::StateData::~StateData() {
if (m_pTransferFunc && m_pTransferFunc->m_pPDFDoc) {
CPDF_DocRenderData* pDocCache = m_pTransferFunc->m_pPDFDoc->GetRenderData();
- if (pDocCache)
- pDocCache->ReleaseTransferFunc(m_pTR);
+ if (pDocCache) {
+ m_pTransferFunc.Reset(); // Give up our reference first.
+ pDocCache->MaybePurgeTransferFunc(m_pTR);
+ }
}
}