diff options
author | tsepez <tsepez@chromium.org> | 2016-11-22 13:01:40 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-22 13:01:40 -0800 |
commit | 6136ec6347a5858a85912a805ea41126863558cd (patch) | |
tree | 9aee627585a525844e9861fee6012509bbc39a14 /core/fpdfapi/render | |
parent | 687fbde2e4ee13637cb3fd9b1fec39a436ef73d7 (diff) | |
download | pdfium-6136ec6347a5858a85912a805ea41126863558cd.tar.xz |
Ensure CPDF_CountedObjects only made from owned references.
Deletion of said object is still inflicted on the callers. But
that's an issue for another day.
Review-Url: https://codereview.chromium.org/2523743004
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r-- | core/fpdfapi/render/cpdf_docrenderdata.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index c17b4d594e..7ac0353d42 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -55,8 +55,8 @@ CPDF_Type3Cache* CPDF_DocRenderData::GetCachedType3(CPDF_Type3Font* pFont) { CPDF_CountedObject<CPDF_Type3Cache>* pCache; auto it = m_Type3FaceMap.find(pFont); if (it == m_Type3FaceMap.end()) { - CPDF_Type3Cache* pType3 = new CPDF_Type3Cache(pFont); - pCache = new CPDF_CountedObject<CPDF_Type3Cache>(pType3); + pCache = new CPDF_CountedObject<CPDF_Type3Cache>( + pdfium::MakeUnique<CPDF_Type3Cache>(pFont)); m_Type3FaceMap[pFont] = pCache; } else { pCache = it->second; @@ -104,9 +104,10 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { if (!pFuncs[0]) return nullptr; } - CPDF_TransferFunc* pTransfer = new CPDF_TransferFunc(m_pPDFDoc); CPDF_CountedObject<CPDF_TransferFunc>* pTransferCounter = - new CPDF_CountedObject<CPDF_TransferFunc>(pTransfer); + new CPDF_CountedObject<CPDF_TransferFunc>( + pdfium::MakeUnique<CPDF_TransferFunc>(m_pPDFDoc)); + CPDF_TransferFunc* pTransfer = pTransferCounter->get(); m_TransferFuncMap[pObj] = pTransferCounter; FX_FLOAT output[kMaxOutputs]; FXSYS_memset(output, 0, sizeof(output)); |