mirror of
https://github.com/lubosz/overte.git
synced 2025-04-08 06:04:06 +02:00
Fixed object containing UniquePersistent
This commit is contained in:
parent
9fd2f4ed08
commit
8e718262bd
6 changed files with 39 additions and 1 deletions
|
@ -906,7 +906,7 @@ void ScriptManager::run() {
|
|||
|
||||
// TODO: Integrate this with signals/slots instead of reimplementing throttling for ScriptManager
|
||||
while (!_isFinished) {
|
||||
qCDebug(scriptengine) << "In script event loop";
|
||||
//qCDebug(scriptengine) << "In script event loop";
|
||||
|
||||
auto beforeSleep = clock::now();
|
||||
|
||||
|
|
|
@ -203,6 +203,11 @@ QObject* ScriptObjectV8Proxy::unwrap(const V8ScriptValue& val) {
|
|||
}
|
||||
|
||||
ScriptObjectV8Proxy::~ScriptObjectV8Proxy() {
|
||||
auto isolate = _engine->getIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::Isolate::Scope isolateScope(isolate);
|
||||
v8::HandleScope handleScope(isolate);
|
||||
_v8Object.Reset();
|
||||
if(_object) qDebug(scriptengine) << "Deleting object proxy: " << name();
|
||||
if (_ownsObject) {
|
||||
QObject* qobject = _object;
|
||||
|
@ -664,6 +669,15 @@ ScriptVariantV8Proxy::ScriptVariantV8Proxy(ScriptEngineV8* engine, const QVarian
|
|||
_name = QString::fromLatin1(variant.typeName());
|
||||
}
|
||||
|
||||
ScriptVariantV8Proxy::~ScriptVariantV8Proxy() {
|
||||
auto isolate = _engine->getIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::Isolate::Scope isolateScope(isolate);
|
||||
v8::HandleScope handleScope(isolate);
|
||||
_v8ObjectTemplate.Reset();
|
||||
_v8Object.Reset();
|
||||
}
|
||||
|
||||
V8ScriptValue ScriptVariantV8Proxy::newVariant(ScriptEngineV8* engine, const QVariant& variant, V8ScriptValue proto) {
|
||||
auto isolate = engine->getIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
|
@ -1147,6 +1161,14 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume
|
|||
return QVariant();
|
||||
}*/
|
||||
|
||||
ScriptSignalV8Proxy::~ScriptSignalV8Proxy() {
|
||||
auto isolate = _engine->getIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::Isolate::Scope isolateScope(isolate);
|
||||
v8::HandleScope handleScope(isolate);
|
||||
_v8Context.Reset();
|
||||
}
|
||||
|
||||
QString ScriptSignalV8Proxy::fullName() const {
|
||||
Q_ASSERT(_object);
|
||||
if (!_object) return "";
|
||||
|
|
|
@ -129,6 +129,7 @@ private: // storage
|
|||
class ScriptVariantV8Proxy final {
|
||||
public: // construction
|
||||
ScriptVariantV8Proxy(ScriptEngineV8* engine, const QVariant& variant, V8ScriptValue scriptProto, ScriptObjectV8Proxy* proto);
|
||||
~ScriptVariantV8Proxy();
|
||||
|
||||
static V8ScriptValue newVariant(ScriptEngineV8* engine, const QVariant& variant, V8ScriptValue proto);
|
||||
static ScriptVariantV8Proxy* unwrapProxy(const V8ScriptValue& val);
|
||||
|
@ -232,6 +233,8 @@ public: // construction
|
|||
_v8Context.Reset(_engine->getIsolate(), _engine->getContext());
|
||||
}
|
||||
|
||||
~ScriptSignalV8Proxy();
|
||||
|
||||
private: // implementation
|
||||
virtual int qt_metacall(QMetaObject::Call call, int id, void** arguments) override;
|
||||
int discoverMetaCallIdx();
|
||||
|
|
|
@ -31,6 +31,16 @@ V8ScriptValueIterator::V8ScriptValueIterator(ScriptEngineV8* engine, v8::Local<v
|
|||
_currentIndex = -1;
|
||||
}
|
||||
|
||||
V8ScriptValueIterator::~V8ScriptValueIterator() {
|
||||
auto isolate = _engine->getIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::Isolate::Scope isolateScope(isolate);
|
||||
v8::HandleScope handleScope(isolate);
|
||||
_propertyNames.Reset();
|
||||
_object.Reset();
|
||||
_context.Reset();
|
||||
}
|
||||
|
||||
bool V8ScriptValueIterator::hasNext() const {
|
||||
return _currentIndex < _length - 1;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
class V8ScriptValueIterator {
|
||||
public:
|
||||
V8ScriptValueIterator(ScriptEngineV8* engine, v8::Local<v8::Value> object);
|
||||
~V8ScriptValueIterator();
|
||||
bool hasNext() const;
|
||||
QString name() const;
|
||||
void next();
|
||||
|
|
|
@ -70,6 +70,7 @@ V8ScriptValue ScriptValueV8Wrapper::fullUnwrap(ScriptEngineV8* engine, const Scr
|
|||
}
|
||||
|
||||
ScriptValue ScriptValueV8Wrapper::call(const ScriptValue& thisObject, const ScriptValueList& args) {
|
||||
Q_ASSERT(_engine == _value.getEngine());
|
||||
auto isolate = _engine->getIsolate();
|
||||
v8::Locker locker(isolate);
|
||||
v8::Isolate::Scope isolateScope(isolate);
|
||||
|
@ -104,6 +105,7 @@ ScriptValue ScriptValueV8Wrapper::call(const ScriptValue& thisObject, const Scri
|
|||
qCDebug(scriptengine) << "Function call failed: \"" << _engine->formatErrorMessageFromTryCatch(tryCatch);
|
||||
}
|
||||
v8::Local<v8::Value> result;
|
||||
Q_ASSERT(_engine == _value.getEngine());
|
||||
if (maybeResult.ToLocal(&result)) {
|
||||
return ScriptValue(new ScriptValueV8Wrapper(_engine, V8ScriptValue(_engine, result)));
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue