summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2016-02-02 18:12:23 -0800
committerJun Fang <jun_fang@foxitsoftware.com>2016-02-02 18:12:23 -0800
commitc30d5bf3efaef5c7254ae326466e6a35cff63365 (patch)
tree7dbbd7002bafe4343f121f503c39006f83e9f760 /fpdfsdk
parentef86dcd61c4b42d3787638e6ec5b96d4d7b4167b (diff)
downloadpdfium-c30d5bf3efaef5c7254ae326466e6a35cff63365.tar.xz
XFA: Fix a crashier in SetFocus()
BUG=pdfium:374 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1640233004 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fsdk_mgr.h4
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp8
2 files changed, 10 insertions, 2 deletions
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index 72497e2d5f..2df44c7ca1 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -404,6 +404,10 @@ class CPDFDoc_Environment final {
}
return L"";
}
+ void FFI_PageEvent(int iPageIndex, int iEventType) const {
+ // Todo: call a call-back function when it's implemented
+ // in applicaiton's side.
+ }
#endif // PDF_ENABLE_XFA
int JS_appAlert(const FX_WCHAR* Msg,
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
index e1f14aa9d4..b8549fce74 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
@@ -477,17 +477,21 @@ void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView,
return;
}
CPDFXFA_Page* pPage = nullptr;
+ CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
if (dwFlags == XFA_PAGEVIEWEVENT_PostAdded) {
- pPage = GetPage(pPageView->GetPageViewIndex());
+ int nPageIndex = pPageView->GetPageViewIndex();
+ pPage = GetPage(nPageIndex);
if (pPage)
pPage->SetXFAPageView(pPageView);
+ pEnv->FFI_PageEvent(nPageIndex, dwFlags);
return;
}
pPage = GetPage(pPageView);
if (!pPage)
return;
- pPage->SetXFAPageView(nullptr);
+ pEnv->FFI_PageEvent(pPage->GetPageIndex(), dwFlags);
m_pSDKDoc->GetPageView(pPage)->ClearFXAnnots();
+ pPage->Release();
}
void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget,