diff options
Diffstat (limited to 'xfa/fxfa/cxfa_ffdoc.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_ffdoc.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index fdeacf7f0f..e14500a725 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -332,10 +332,6 @@ bool CXFA_FFDoc::CloseDoc() { m_DocView.reset(); m_pNotify.reset(nullptr); m_pApp->GetXFAFontMgr()->ReleaseDocFonts(this); - - for (const auto& pair : m_HashToDibDpiMap) - delete pair.second.pDibSource; - m_HashToDibDpiMap.clear(); m_pApp->ClearEventTargets(); return true; @@ -345,9 +341,10 @@ CPDF_Document* CXFA_FFDoc::GetPDFDoc() { return m_pPDFDoc; } -CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, - int32_t& iImageXDpi, - int32_t& iImageYDpi) { +CFX_RetainPtr<CFX_DIBitmap> CXFA_FFDoc::GetPDFNamedImage( + const CFX_WideStringC& wsName, + int32_t& iImageXDpi, + int32_t& iImageYDpi) { if (!m_pPDFDoc) return nullptr; @@ -356,7 +353,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, if (it != m_HashToDibDpiMap.end()) { iImageXDpi = it->second.iImageXDpi; iImageYDpi = it->second.iImageYDpi; - return static_cast<CFX_DIBitmap*>(it->second.pDibSource); + return it->second.pDibSource.As<CFX_DIBitmap>(); } CPDF_Dictionary* pRoot = m_pPDFDoc->GetRoot(); @@ -396,7 +393,7 @@ CFX_DIBitmap* CXFA_FFDoc::GetPDFNamedImage(const CFX_WideStringC& wsName, IFX_MemoryStream::Create((uint8_t*)streamAcc.GetData(), streamAcc.GetSize()); - CFX_DIBitmap* pDibSource = XFA_LoadImageFromBuffer( + CFX_RetainPtr<CFX_DIBitmap> pDibSource = XFA_LoadImageFromBuffer( pImageFileRead, FXCODEC_IMAGE_UNKNOWN, iImageXDpi, iImageYDpi); m_HashToDibDpiMap[dwHash] = {pDibSource, iImageXDpi, iImageYDpi}; return pDibSource; |