bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) { if (m_pBitmap || !m_pForm) return true; if (m_pForm->GetPageObjectList()->size() != 1 || m_bColored) return false; auto& pPageObj = m_pForm->GetPageObjectList()->front(); if (!pPageObj->IsImage()) return false; m_ImageMatrix = pPageObj->AsImage()->matrix(); { // |pSource| actually gets assigned a CPDF_DIBBase, which has pointers // into objects owned by |m_pForm|. Make sure it is out of scope before // clearing the form. RetainPtr<CFX_DIBBase> pSource = pPageObj->AsImage()->GetImage()->LoadDIBBase(); // Clone() is non-virtual, and can't be overloaded by CPDF_DIBBase to // return a clone of the subclass as one would typically expect from a // such a method. Instead, it only clones the CFX_DIBBase, none of whose // members point to objects owned by the form. As a result, |m_pBitmap| // may outlive |m_pForm|. if (pSource) m_pBitmap = pSource->Clone(nullptr); } m_pForm.reset(); return true; }