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 | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h index 1fb0348263..1e9f3a97ac 100644 --- a/fpdfsdk/include/javascript/JS_Runtime.h +++ b/fpdfsdk/include/javascript/JS_Runtime.h @@ -73,6 +73,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 7dfe326c54..927965e5a4 100644 --- a/fpdfsdk/src/javascript/JS_Runtime.cpp +++ b/fpdfsdk/src/javascript/JS_Runtime.cpp @@ -101,7 +101,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 (CPDFXFA_App::GetInstance()->GetJSERuntime()) { // TODO(tsepez): CPDFXFA_App should also use the embedder provided isolate. m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERuntime(); @@ -115,6 +116,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; } v8::Isolate* isolate = m_isolate; @@ -149,6 +151,8 @@ CJS_Runtime::~CJS_Runtime() { m_pFieldEventPath = NULL; m_context.Reset(); + if (m_isolateManaged) + m_isolate->Dispose(); m_isolate = NULL; } |