mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Removed deadlock in signal proxy disconnect again
This commit is contained in:
parent
d25e5491eb
commit
887ebd5365
4 changed files with 18 additions and 13 deletions
|
@ -408,7 +408,8 @@ ScriptEngineV8::ScriptEngineV8(ScriptManager* scriptManager) :
|
|||
// --jitless - might improve debugging performance due to no JIT?
|
||||
// --assert-types
|
||||
|
||||
v8::V8::SetFlagsFromString("--stack-size=256 --verify-heap");
|
||||
v8::V8::InitializeICU();
|
||||
v8::V8::SetFlagsFromString("--stack-size=256 --verify-heap --assert-types");
|
||||
//v8::V8::SetFlagsFromString("--stack-size=256 --single-threaded");
|
||||
v8::Platform* platform = getV8Platform();
|
||||
v8::V8::InitializePlatform(platform);
|
||||
|
|
|
@ -136,7 +136,7 @@ public: // ScriptEngine implementation
|
|||
QString scriptValueDebugDetailsV8(const V8ScriptValue &value);
|
||||
virtual QString scriptValueDebugListMembers(const ScriptValue &value) override;
|
||||
QString scriptValueDebugListMembersV8(const V8ScriptValue &v8Value);
|
||||
virtual void logBacktrace(const QString &title) override;
|
||||
virtual void logBacktrace(const QString &title = QString("")) override;
|
||||
|
||||
// helper to detect and log warnings when other code invokes QScriptEngine/BaseScriptEngine in thread-unsafe ways
|
||||
inline bool IS_THREADSAFE_INVOCATION(const QString& method) { return ScriptEngine::IS_THREADSAFE_INVOCATION(method); }
|
||||
|
@ -185,7 +185,9 @@ public: // not for public use, but I don't like how Qt strings this along with p
|
|||
bool convertJSObjectToVariant(v8::Local<v8::Object> object, QVariant &dest);
|
||||
V8ScriptValue castVariantToValue(const QVariant& val);
|
||||
QString valueType(const V8ScriptValue& val);
|
||||
v8::Isolate* getIsolate() {return _v8Isolate;}
|
||||
v8::Isolate* getIsolate() {
|
||||
Q_ASSERT(_v8Isolate != nullptr);
|
||||
return _v8Isolate;}
|
||||
v8::Local<v8::Context> getContext();
|
||||
const v8::Local<v8::Context> getConstContext() const;
|
||||
QString formatErrorMessageFromTryCatch(v8::TryCatch &tryCatch);
|
||||
|
|
|
@ -1186,14 +1186,15 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
|||
args[arg] = _engine->castVariantToValue(argValue).get();
|
||||
}*/
|
||||
|
||||
/*QList<Connection> connections;
|
||||
QList<Connection> connections;
|
||||
withReadLock([&]{
|
||||
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([&]{
|
||||
//withReadLock([&]{
|
||||
{
|
||||
// V8TODO: check all other lambda functions to make sure they have handle scope - could they cause crashes otherwise?
|
||||
v8::HandleScope handleScope(isolate);
|
||||
// V8TODO: should we use function creation context, or context in which connect happened?
|
||||
|
@ -1201,14 +1202,14 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
|||
v8::Context::Scope contextScope(context);
|
||||
v8::Local<v8::Value> args[Q_METAMETHOD_INVOKE_MAX_ARGS];
|
||||
int numArgs = _meta.parameterCount();
|
||||
//for (ConnectionList::iterator iter = connections.begin(); iter != connections.end(); ++iter) {
|
||||
for (int arg = 0; arg < numArgs; ++arg) {
|
||||
int methodArgTypeId = _meta.parameterType(arg);
|
||||
Q_ASSERT(methodArgTypeId != QMetaType::UnknownType);
|
||||
QVariant argValue(methodArgTypeId, arguments[arg+1]);
|
||||
QVariant argValue(methodArgTypeId, arguments[arg + 1]);
|
||||
args[arg] = _engine->castVariantToValue(argValue).get();
|
||||
}
|
||||
for (ConnectionList::iterator iter = _connections.begin(); iter != _connections.end(); ++iter) {
|
||||
//for (ConnectionList::iterator iter = _connections.begin(); iter != _connections.end(); ++iter) {
|
||||
for (ConnectionList::iterator iter = connections.begin(); iter != connections.end(); ++iter) {
|
||||
Connection& conn = *iter;
|
||||
{
|
||||
/*if (!conn.callback.get()->IsFunction()) {
|
||||
|
@ -1228,7 +1229,7 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
|||
|
||||
Q_ASSERT(!conn.callback.get().IsEmpty());
|
||||
Q_ASSERT(!conn.callback.get()->IsUndefined());
|
||||
if(conn.callback.get()->IsNull()) {
|
||||
if (conn.callback.get()->IsNull()) {
|
||||
qDebug() << "ScriptSignalV8Proxy::qt_metacall: Connection callback is Null";
|
||||
_engine->popContext();
|
||||
continue;
|
||||
|
@ -1258,7 +1259,8 @@ int ScriptSignalV8Proxy::qt_metacall(QMetaObject::Call call, int id, void** argu
|
|||
//_engine->popContext();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//});
|
||||
|
||||
_totalCallTime_s += callTimer.elapsed() / 1000.0;
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
// find 3d overlays near each hand
|
||||
var nearbyOverlayIDs = [];
|
||||
var h;
|
||||
for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
/*for (h = LEFT_HAND; h <= RIGHT_HAND; h++) {
|
||||
if (controllerLocations[h].valid) {
|
||||
var nearbyOverlays =
|
||||
Overlays.findOverlays(controllerLocations[h].position, NEAR_MAX_RADIUS * sensorScaleFactor);
|
||||
|
@ -293,7 +293,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
|||
} else {
|
||||
nearbyOverlayIDs.push([]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// find entities near each hand
|
||||
var nearbyEntityProperties = [[], []];
|
||||
|
|
Loading…
Reference in a new issue