Chromium Code Reviews| Index: fpdfsdk/cpdfsdk_widget.cpp |
| diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp |
| index d4fc5c790022acc04fb23fa21deb8f5ee9b45d76..6849c83c97453d0d6f28bbde768cada4a7eabde8 100644 |
| --- a/fpdfsdk/cpdfsdk_widget.cpp |
| +++ b/fpdfsdk/cpdfsdk_widget.cpp |
| @@ -1815,9 +1815,6 @@ CPWL_Color CPDFSDK_Widget::GetFillPWLColor() const { |
| void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, |
| CPDF_Stream* pImage) { |
| - CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
| - ASSERT(pDoc); |
| - |
| CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); |
| CPDF_Stream* pStream = pAPDict->GetStreamFor(sAPType); |
| CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
| @@ -1829,14 +1826,15 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, |
| sImageAlias = "IMG"; |
| } |
| + CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
|
dsinclair
2016/09/19 13:24:34
Can we add the ASSERT back in here? We don't de-re
Tom Sepez
2016/09/19 18:24:59
We now de-ref it due to the has-a change. Also t
|
| CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources"); |
| if (!pStreamResList) { |
| - pStreamResList = new CPDF_Dictionary(); |
| + pStreamResList = new CPDF_Dictionary(pDoc); |
| pStreamDict->SetFor("Resources", pStreamResList); |
| } |
| if (pStreamResList) { |
| - CPDF_Dictionary* pXObject = new CPDF_Dictionary; |
| + CPDF_Dictionary* pXObject = new CPDF_Dictionary(pDoc); |
| pXObject->SetReferenceFor(sImageAlias, pDoc, pImage); |
| pStreamResList->SetFor("XObject", pXObject); |
| } |