summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2016-02-19 09:29:08 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2016-02-19 09:29:08 +0800
commit5634d5d81339500e4836d019c3d3cf6f5002612d (patch)
tree37ced985e6a3530c580369008d9c3f445faafc55 /xfa
parentd17a3af124c9e4fa218d5527910c0c9f22559a8f (diff)
downloadpdfium-5634d5d81339500e4836d019c3d3cf6f5002612d.tar.xz
Fix a crasher in CXFA_Node::Script_Form_Recalculate()
BUG=pdfium:398 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1704343002 .
Diffstat (limited to 'xfa')
-rw-r--r--xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp2
-rw-r--r--xfa/src/fxfa/src/common/xfa_script.h2
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_imp.cpp1
-rw-r--r--xfa/src/fxfa/src/parser/xfa_script_imp.h8
4 files changed, 5 insertions, 8 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
index 81bfa53dc3..04123588b4 100644
--- a/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
+++ b/xfa/src/fxfa/src/app/xfa_ffwidgetacc.cpp
@@ -655,7 +655,7 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script,
}
CXFA_FFDoc* pDoc = GetDoc();
IXFA_ScriptContext* pContext = pDoc->GetXFADoc()->GetScriptContext();
- pContext->SetEventParam(pEventParam);
+ pContext->SetEventParam(*pEventParam);
pContext->SetRunAtType((XFA_ATTRIBUTEENUM)script.GetRunAt());
CXFA_NodeArray refNodes;
if (pEventParam->m_eType == XFA_EVENT_InitCalculate ||
diff --git a/xfa/src/fxfa/src/common/xfa_script.h b/xfa/src/fxfa/src/common/xfa_script.h
index 68f8117041..630a4fd329 100644
--- a/xfa/src/fxfa/src/common/xfa_script.h
+++ b/xfa/src/fxfa/src/common/xfa_script.h
@@ -78,7 +78,7 @@ class IXFA_ScriptContext {
virtual void Release() = 0;
virtual void Initialize(FXJSE_HRUNTIME hRuntime) = 0;
- virtual void SetEventParam(CXFA_EventParam* pEventParam) = 0;
+ virtual void SetEventParam(CXFA_EventParam param) = 0;
virtual CXFA_EventParam* GetEventParam() = 0;
virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType,
const CFX_WideStringC& wsScript,
diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
index 3c8e1c14a3..4b808a4739 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_script_imp.cpp
@@ -23,7 +23,6 @@ CXFA_ScriptContext::CXFA_ScriptContext(CXFA_Document* pDocument)
m_hJsRuntime(nullptr),
m_hJsClass(nullptr),
m_eScriptType(XFA_SCRIPTLANGTYPE_Unkown),
- m_pEventParam(nullptr),
m_pScriptNodeArray(nullptr),
m_pResolveProcessor(nullptr),
m_hFM2JSContext(nullptr),
diff --git a/xfa/src/fxfa/src/parser/xfa_script_imp.h b/xfa/src/fxfa/src/parser/xfa_script_imp.h
index 8b1b6c6914..a0610fae9f 100644
--- a/xfa/src/fxfa/src/parser/xfa_script_imp.h
+++ b/xfa/src/fxfa/src/parser/xfa_script_imp.h
@@ -18,10 +18,8 @@ class CXFA_ScriptContext : public IXFA_ScriptContext {
~CXFA_ScriptContext();
virtual void Release();
virtual void Initialize(FXJSE_HRUNTIME hRuntime);
- virtual void SetEventParam(CXFA_EventParam* pEventParam) {
- m_pEventParam = pEventParam;
- }
- virtual CXFA_EventParam* GetEventParam() { return m_pEventParam; }
+ virtual void SetEventParam(CXFA_EventParam param) { m_eventParam = param; }
+ virtual CXFA_EventParam* GetEventParam() { return &m_eventParam; }
virtual FX_BOOL RunScript(XFA_SCRIPTLANGTYPE eScriptType,
const CFX_WideStringC& wsScript,
FXJSE_HVALUE hRetValue,
@@ -109,7 +107,7 @@ class CXFA_ScriptContext : public IXFA_ScriptContext {
CFX_MapPtrTemplate<CXFA_Object*, FXJSE_HVALUE> m_mapXFAToHValue;
FXJSE_CLASS m_JsGlobalVariablesClass;
CFX_MapPtrTemplate<CXFA_Object*, FXJSE_HCONTEXT> m_mapVariableToHValue;
- CXFA_EventParam* m_pEventParam;
+ CXFA_EventParam m_eventParam;
CXFA_NodeArray m_upObjectArray;
CFX_PtrArray m_CacheListArray;
CXFA_NodeArray* m_pScriptNodeArray;