mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 14:47:19 +02:00
Further work on V8
This commit is contained in:
parent
b786ffccd5
commit
acbec55b70
2 changed files with 10 additions and 1 deletions
|
@ -344,6 +344,8 @@ bool ScriptEngineV8::castValueToVariant(const V8ScriptValue& v8Val, QVariant& de
|
|||
if (demarshalFunc) {
|
||||
dest = QVariant(destTypeId, static_cast<void*>(NULL));
|
||||
ScriptValue wrappedVal(new ScriptValueV8Wrapper(this, v8Val));
|
||||
Q_ASSERT(dest.constData() != nullptr);
|
||||
//V8TODO: Data should never be written to dest.constData() according to Qt documentation.
|
||||
bool success = demarshalFunc(wrappedVal, const_cast<void*>(dest.constData()));
|
||||
if(!success) dest = QVariant();
|
||||
return success;
|
||||
|
@ -689,6 +691,7 @@ V8ScriptValue ScriptEngineV8::castVariantToValue(const QVariant& val) {
|
|||
_customTypeProtect.unlock();
|
||||
}
|
||||
if (marshalFunc) {
|
||||
Q_ASSERT(val.constData() != nullptr);
|
||||
ScriptValue wrappedVal = marshalFunc(this, val.constData());
|
||||
return ScriptValueV8Wrapper::fullUnwrap(this, wrappedVal);
|
||||
}
|
||||
|
|
|
@ -1087,6 +1087,8 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
|||
connections = _connections;
|
||||
});*/
|
||||
|
||||
// V8TODO: this may cause deadlocks on connect/disconnect, so the connect/disconnect procedure needs to be reworked.
|
||||
// It should probably add events to a separate list that would be processed before and after all the events for the signal.
|
||||
withReadLock([&]{
|
||||
//for (ConnectionList::iterator iter = connections.begin(); iter != connections.end(); ++iter) {
|
||||
for (ConnectionList::iterator iter = _connections.begin(); iter != _connections.end(); ++iter) {
|
||||
|
@ -1099,7 +1101,11 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
|||
|
||||
Q_ASSERT(!conn.callback.get().IsEmpty());
|
||||
Q_ASSERT(!conn.callback.get()->IsUndefined());
|
||||
Q_ASSERT(!conn.callback.get()->IsNull());
|
||||
if(conn.callback.get()->IsNull()) {
|
||||
qDebug() << "ScriptSignalV8Proxy::qt_metacall: Connection callback is Null";
|
||||
_engine->popContext();
|
||||
continue;
|
||||
}
|
||||
if (!conn.callback.get()->IsFunction()) {
|
||||
auto stringV8 = conn.callback.get()->ToDetailString(functionContext).ToLocalChecked();
|
||||
QString error = *v8::String::Utf8Value(_engine->getIsolate(), stringV8);
|
||||
|
|
Loading…
Reference in a new issue