Index: fpdfsdk/jsapi/fxjs_v8.cpp |
diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp |
index adbdeb12e69f0db80c77c8e8040f10527ab5298f..473b54631842a3533ce0fa6d5bea4e29ba016c8a 100644 |
--- a/fpdfsdk/jsapi/fxjs_v8.cpp |
+++ b/fpdfsdk/jsapi/fxjs_v8.cpp |
@@ -371,6 +371,11 @@ 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); |
@@ -397,12 +402,8 @@ void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, |
for (int i = 0; i < maxID; ++i) |
delete CFXJS_ObjDefinition::ForID(pIsolate, i); |
- FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate); |
- if (pData) { |
- pData->ReleaseDynamicObjsMap(); |
- pIsolate->SetData(g_embedderDataSlot, nullptr); |
- delete pData; |
- } |
+ pIsolate->SetData(g_embedderDataSlot, nullptr); |
+ delete pData; |
} |
IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate) { |