mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 04:07:11 +02:00
Fixed V8 crash with Create App
This commit is contained in:
parent
b554fc70ea
commit
d25e5491eb
2 changed files with 12 additions and 5 deletions
|
@ -31,6 +31,7 @@ public:
|
|||
void next();
|
||||
V8ScriptValue value();
|
||||
private:
|
||||
// V8TODO: maybe these should be WeakPersistent?
|
||||
v8::UniquePersistent<v8::Array> _propertyNames;
|
||||
v8::UniquePersistent<v8::Object> _object;
|
||||
v8::UniquePersistent<v8::Context> _context;
|
||||
|
|
|
@ -31,7 +31,8 @@ public:
|
|||
v8::Isolate::Scope isolateScope(_engine->getIsolate());
|
||||
v8::HandleScope handleScope(_engine->getIsolate());
|
||||
v8::Context::Scope(_engine->getContext());
|
||||
_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), value));
|
||||
_value.reset(new v8::Persistent<T>(_engine->getIsolate(), value));
|
||||
//_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), value));
|
||||
};
|
||||
|
||||
V8ScriptValueTemplate& operator= (const V8ScriptValueTemplate &source) {
|
||||
|
@ -40,7 +41,8 @@ public:
|
|||
v8::HandleScope handleScope(_engine->getIsolate());
|
||||
v8::Context::Scope(_engine->getContext());
|
||||
_engine = source.getEngine();
|
||||
_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), source.constGet()));
|
||||
_value.reset(new v8::Persistent<T>(_engine->getIsolate(), source.constGet()));
|
||||
//_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), source.constGet()));
|
||||
return *this;
|
||||
};
|
||||
|
||||
|
@ -49,7 +51,8 @@ public:
|
|||
v8::Isolate::Scope isolateScope(_engine->getIsolate());
|
||||
v8::HandleScope handleScope(_engine->getIsolate());
|
||||
v8::Context::Scope(_engine->getContext());
|
||||
_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), v8::Local<T>()));
|
||||
//_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), v8::Local<T>()));
|
||||
_value.reset(new v8::Persistent<T>(_engine->getIsolate(), v8::Local<T>()));
|
||||
};
|
||||
|
||||
V8ScriptValueTemplate(const V8ScriptValueTemplate &copied) : _engine(copied.getEngine()) {
|
||||
|
@ -57,7 +60,8 @@ public:
|
|||
v8::Isolate::Scope isolateScope(_engine->getIsolate());
|
||||
v8::HandleScope handleScope(_engine->getIsolate());
|
||||
v8::Context::Scope(_engine->getContext());
|
||||
_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), copied.constGet()));
|
||||
//_value.reset(new v8::UniquePersistent<T>(_engine->getIsolate(), copied.constGet()));
|
||||
_value.reset(new v8::Persistent<T>(_engine->getIsolate(), copied.constGet()));
|
||||
}
|
||||
|
||||
v8::Local<T> get() {
|
||||
|
@ -104,7 +108,9 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
std::shared_ptr<v8::UniquePersistent<T>> _value;
|
||||
// std::shared_ptr<v8::UniquePersistent<T>> _value;
|
||||
// V8TODO: Persistent needs reset to release object? It may cause memory leaks here
|
||||
std::shared_ptr<v8::Persistent<T>> _value;
|
||||
// V8TODO: maybe make it weak
|
||||
// does it need , CopyablePersistentTraits<Value>?
|
||||
// V8TODO: is context needed at all?
|
||||
|
|
Loading…
Reference in a new issue