Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: fpdfsdk/jsapi/fxjs_v8.cpp

Issue 1822423002: Preserve m_pDynamicObjsMap until FXJS_PerIsolateData is destroyed (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Test. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/jsapi/fxjs_v8.cpp
diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp
index 156f1c9a3ca04c68306e5de39c026890acce3df7..a2cc4811dd3e4023e0435243f64f5cbbfd2f0070 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) {
« no previous file with comments | « no previous file | fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698