summaryrefslogtreecommitdiff
path: root/fxjs/cfxjse_runtimedata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cfxjse_runtimedata.cpp')
-rw-r--r--fxjs/cfxjse_runtimedata.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/fxjs/cfxjse_runtimedata.cpp b/fxjs/cfxjse_runtimedata.cpp
index 2c9379526e..021fb1dbe4 100644
--- a/fxjs/cfxjse_runtimedata.cpp
+++ b/fxjs/cfxjse_runtimedata.cpp
@@ -20,10 +20,8 @@ class FXJSE_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
};
void Runtime_DisposeCallback(v8::Isolate* pIsolate, bool bOwned) {
- if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate)) {
- delete pData->m_pFXJSERuntimeData;
- pData->m_pFXJSERuntimeData = nullptr;
- }
+ if (FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate))
+ delete pData;
if (bOwned)
pIsolate->Dispose();
}
@@ -77,8 +75,10 @@ CFXJSE_RuntimeData::CFXJSE_RuntimeData(v8::Isolate* pIsolate)
CFXJSE_RuntimeData::~CFXJSE_RuntimeData() {}
-CFXJSE_RuntimeData* CFXJSE_RuntimeData::Create(v8::Isolate* pIsolate) {
- CFXJSE_RuntimeData* pRuntimeData = new CFXJSE_RuntimeData(pIsolate);
+std::unique_ptr<CFXJSE_RuntimeData> CFXJSE_RuntimeData::Create(
+ v8::Isolate* pIsolate) {
+ std::unique_ptr<CFXJSE_RuntimeData> pRuntimeData(
+ new CFXJSE_RuntimeData(pIsolate));
CFXJSE_ScopeUtil_IsolateHandle scope(pIsolate);
v8::Local<v8::FunctionTemplate> hFuncTemplate =
v8::FunctionTemplate::New(pIsolate);
@@ -101,7 +101,7 @@ CFXJSE_RuntimeData* CFXJSE_RuntimeData::Get(v8::Isolate* pIsolate) {
FXJS_PerIsolateData* pData = FXJS_PerIsolateData::Get(pIsolate);
if (!pData->m_pFXJSERuntimeData)
pData->m_pFXJSERuntimeData = CFXJSE_RuntimeData::Create(pIsolate);
- return pData->m_pFXJSERuntimeData;
+ return pData->m_pFXJSERuntimeData.get();
}
CFXJSE_IsolateTracker* CFXJSE_IsolateTracker::g_pInstance = nullptr;