Index: fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp |
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp |
index 44e9c72ddc09ad501105b34f4026c7e87c6d3208..1006bf9c440d265a0a752a3ab5f5fb9ee6960a9b 100644 |
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp |
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp |
@@ -31,7 +31,8 @@ CPDFXFA_App::CPDFXFA_App() |
m_pXFAApp(NULL), |
m_pFontMgr(NULL), |
m_hJSERuntime(NULL), |
- m_csAppType(JS_STR_VIEWERTYPE_STANDARD) { |
+ m_csAppType(JS_STR_VIEWERTYPE_STANDARD), |
+ m_bOwnedRuntime(false) { |
m_pEnvList.RemoveAll(); |
} |
@@ -43,7 +44,7 @@ CPDFXFA_App::~CPDFXFA_App() { |
m_pXFAApp = NULL; |
#ifdef PDF_ENABLE_XFA |
- FXJSE_Runtime_Release(m_hJSERuntime); |
+ FXJSE_Runtime_Release(m_hJSERuntime, m_bOwnedRuntime); |
m_hJSERuntime = NULL; |
FXJSE_Finalize(); |
@@ -51,12 +52,13 @@ CPDFXFA_App::~CPDFXFA_App() { |
#endif |
} |
-FX_BOOL CPDFXFA_App::Initialize() { |
+FX_BOOL CPDFXFA_App::Initialize(FXJSE_HRUNTIME hRuntime) { |
#ifdef PDF_ENABLE_XFA |
BC_Library_Init(); |
FXJSE_Initialize(); |
- m_hJSERuntime = FXJSE_Runtime_Create(); |
+ m_bOwnedRuntime = !hRuntime; |
+ m_hJSERuntime = hRuntime ? hRuntime : FXJSE_Runtime_Create(); |
if (!m_hJSERuntime) |
return FALSE; |