diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/javascript/JS_Runtime.h | 1 | ||||
-rw-r--r-- | fpdfsdk/src/javascript/JS_Runtime.cpp | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index f4dabf017e..3be0f76549 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -68,6 +68,7 @@ class CJS_Runtime : public IFXJS_Runtime { CJS_FieldEvent* m_pFieldEventPath; v8::Isolate* m_isolate; + bool m_isolateManaged; nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator; v8::Global<v8::Context> m_context; }; 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() { |