summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_Runtime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript/JS_Runtime.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index 08cd87c768..4ef34a8d20 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -98,7 +98,8 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
m_pDocument(NULL),
m_bBlocking(FALSE),
m_pFieldEventPath(NULL),
- m_isolate(NULL) {
+ m_isolate(NULL),
+ m_isolateManaged(false) {
if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) {
m_isolate = reinterpret_cast<v8::Isolate*>(
m_pApp->GetFormFillInfo()->m_pJsPlatform->m_isolate);
@@ -109,6 +110,7 @@ CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
v8::Isolate::CreateParams params;
params.array_buffer_allocator = m_pArrayBufferAllocator.get();
m_isolate = v8::Isolate::New(params);
+ m_isolateManaged = true;
}
InitJSObjects();
@@ -133,8 +135,8 @@ CJS_Runtime::~CJS_Runtime() {
m_pFieldEventPath = NULL;
m_context.Reset();
- // m_isolate->Exit();
- m_isolate->Dispose();
+ if (m_isolateManaged)
+ m_isolate->Dispose();
}
FX_BOOL CJS_Runtime::InitJSObjects() {