summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxge/cfx_font.cpp9
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp15
-rw-r--r--fpdfsdk/fpdf_view.cpp11
3 files changed, 25 insertions, 10 deletions
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 08e33d6397..bee1d789ef 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -317,9 +317,14 @@ void CFX_Font::SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) {
#endif // PDF_ENABLE_XFA
CFX_Font::~CFX_Font() {
- if (m_Face)
+ if (m_Face) {
+#ifndef PDF_ENABLE_XFA
+ if (FXFT_Get_Face_External_Stream(m_Face)) {
+ FXFT_Clear_Face_External_Stream(m_Face);
+ }
+#endif // PDF_ENABLE_XFA
DeleteFace();
-
+ }
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
ReleasePlatformResource();
#endif
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 06d197dfba..5cb5f2ced2 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -38,18 +38,19 @@ CPDFSDK_PageView::CPDFSDK_PageView(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
pPDFInterForm->FixPageFields(pPDFPage);
+#ifndef PDF_ENABLE_XFA
pPDFPage->SetView(this);
+#endif // PDF_ENABLE_XFA
}
}
CPDFSDK_PageView::~CPDFSDK_PageView() {
- CPDF_Page* pPDFPage = ToPDFPage(m_page);
- if (pPDFPage) {
- // The call to |ReleaseAnnot| can cause the page pointed to by |m_page| to
- // be freed, which will cause issues if we try to cleanup the pageview ptr
- // in |m_page|. So, reset the pageview pointer before doing anything else.
- pPDFPage->SetView(nullptr);
- }
+#ifndef PDF_ENABLE_XFA
+ // The call to |ReleaseAnnot| can cause the page pointed to by |m_page| to
+ // be freed, which will cause issues if we try to cleanup the pageview pointer
+ // in |m_page|. So, reset the pageview pointer before doing anything else.
+ m_page->AsPDFPage()->SetView(nullptr);
+#endif // PDF_ENABLE_XFA
CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
m_pFormFillEnv->GetAnnotHandlerMgr();
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index f5a164a75f..f0ceb1f378 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -308,7 +308,16 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDF_GetFileVersion(FPDF_DOCUMENT doc,
FPDF_EXPORT unsigned long FPDF_CALLCONV
FPDF_GetDocPermissions(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
- return pDoc ? pDoc->GetUserPermissions() : 0;
+ // https://bugs.chromium.org/p/pdfium/issues/detail?id=499
+ if (!pDoc) {
+#ifndef PDF_ENABLE_XFA
+ return 0;
+#else // PDF_ENABLE_XFA
+ return 0xFFFFFFFF;
+#endif // PDF_ENABLE_XFA
+ }
+
+ return pDoc->GetUserPermissions();
}
FPDF_EXPORT int FPDF_CALLCONV