diff options
author | tsepez <tsepez@chromium.org> | 2016-11-04 11:38:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-04 11:38:40 -0700 |
commit | 33fdebc3da676bff84d0fd0f69b9087c0c12dfeb (patch) | |
tree | 274499f6bc4df60ebb57a52bf78b82180ea52295 /core/fpdfapi/page/cpdf_image.cpp | |
parent | 761eed284e1248f851fbb23beaa45835b644ecee (diff) | |
download | pdfium-33fdebc3da676bff84d0fd0f69b9087c0c12dfeb.tar.xz |
Reland "Remove CPDF_Object::Release() in favor of direct delete"
This reverts commit f0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3.
Review-Url: https://codereview.chromium.org/2478303002
Diffstat (limited to 'core/fpdfapi/page/cpdf_image.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_image.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 23c6e4f786..976d6d8c47 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -25,14 +25,16 @@ CPDF_Image::CPDF_Image(CPDF_Document* pDoc) : m_pDocument(pDoc) {} -CPDF_Image::CPDF_Image(CPDF_Document* pDoc, UniqueStream pStream) +CPDF_Image::CPDF_Image(CPDF_Document* pDoc, + std::unique_ptr<CPDF_Stream> pStream) : m_pDocument(pDoc), m_pStream(pStream.get()), m_pOwnedStream(std::move(pStream)) { if (!m_pStream) return; - m_pOwnedDict = ToDictionary(UniqueObject(m_pStream->GetDict()->Clone())); + m_pOwnedDict = + ToDictionary(std::unique_ptr<CPDF_Object>(m_pStream->GetDict()->Clone())); m_pDict = m_pOwnedDict.get(); FinishInitialization(); } @@ -61,13 +63,15 @@ void CPDF_Image::FinishInitialization() { CPDF_Image* CPDF_Image::Clone() { CPDF_Image* pImage = new CPDF_Image(m_pDocument); if (m_pOwnedStream) { - pImage->m_pOwnedStream = ToStream(UniqueObject(m_pOwnedStream->Clone())); + pImage->m_pOwnedStream = + ToStream(std::unique_ptr<CPDF_Object>(m_pOwnedStream->Clone())); pImage->m_pStream = pImage->m_pOwnedStream.get(); } else { pImage->m_pStream = m_pStream; } if (m_pOwnedDict) { - pImage->m_pOwnedDict = ToDictionary(UniqueObject(m_pOwnedDict->Clone())); + pImage->m_pOwnedDict = + ToDictionary(std::unique_ptr<CPDF_Object>(m_pOwnedDict->Clone())); pImage->m_pDict = pImage->m_pOwnedDict.get(); } else { pImage->m_pDict = m_pDict; @@ -289,10 +293,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { pNewBitmap->Copy(pBitmap); pNewBitmap->ConvertFormat(FXDIB_Rgb); SetImage(pNewBitmap, iCompress); - if (pDict) { - pDict->Release(); - pDict = nullptr; - } + delete pDict; + pDict = nullptr; FX_Free(dest_buf); dest_buf = nullptr; dest_size = 0; |