summaryrefslogtreecommitdiff
path: root/fpdfsdk/jsapi/fxjs_v8.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-24 09:13:17 -0700
committerTom Sepez <tsepez@chromium.org>2016-03-24 09:13:17 -0700
commite432675850161570a8562f8c617da039f51f706d (patch)
tree7b70121e8561ab19ef794b3b739590c4c855f58b /fpdfsdk/jsapi/fxjs_v8.cpp
parentad721813185598ea950c4f896c511bc4e5b41597 (diff)
downloadpdfium-e432675850161570a8562f8c617da039f51f706d.tar.xz
Preserve m_pDynamicObjsMap until FXJS_PerIsolateData is destroyed.
BUG=594120 R=jochen@chromium.org Review URL: https://codereview.chromium.org/1822423002 .
Diffstat (limited to 'fpdfsdk/jsapi/fxjs_v8.cpp')
-rw-r--r--fpdfsdk/jsapi/fxjs_v8.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp
index 473b546318..adbdeb12e6 100644
--- a/fpdfsdk/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/jsapi/fxjs_v8.cpp
@@ -371,11 +371,6 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
v8::Local<v8::Context>::New(pIsolate, *pV8PersistentContext);
v8::Context::Scope context_scope(context);
- FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate);
- if (!pData)
- return;
- pData->ReleaseDynamicObjsMap();
-
int maxID = CFXJS_ObjDefinition::MaxID(pIsolate);
for (int i = 0; i < maxID; ++i) {
CFXJS_ObjDefinition* pObjDef = CFXJS_ObjDefinition::ForID(pIsolate, i);
@@ -402,8 +397,12 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate,
for (int i = 0; i < maxID; ++i)
delete CFXJS_ObjDefinition::ForID(pIsolate, i);
- pIsolate->SetData(g_embedderDataSlot, nullptr);
- delete pData;
+ FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate);
+ if (pData) {
+ pData->ReleaseDynamicObjsMap();
+ pIsolate->SetData(g_embedderDataSlot, nullptr);
+ delete pData;
+ }
}
IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) {