History

Don't use blocking connections on the main thread

Brad Davis committed 9 years ago

Commit b52dd7b1 parent b22daa945 files · +377 −178Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 45 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+4−3
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636
3737 #include <QtScriptTools/QScriptEngineDebugger>
3838
39+#include <shared/QtHelpers.h>
3940 #include <AudioConstants.h>
4041 #include <AudioEffectOptions.h>
4142 #include <AvatarData.h>
@@ -436,12 +437,12 @@ void ScriptEngine::loadURL(const QUrl& scriptURL, bool reload) { · 394 unmodified lines
436437 _fileNameString = url.toString();
437438 _isReloading = reload;
438439
439− // Check that script has a supported file extension
440+ // Check that script has a supported file extension
440441 if (!hasValidScriptSuffix(_fileNameString)) {
441442 scriptErrorMessage("File extension of file: " + _fileNameString + " is not a currently supported script type");
442443 emit errorLoadingScript(_fileNameString);
443444 return;
444− }
445+ }
445446
446447 const auto maxRetries = 0; // for consistency with previous scriptCache->getScript() behavior
447448 auto scriptCache = DependencyManager::get<ScriptCache>();
@@ -964,7 +965,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 516 unmodified lines
964965 qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::evaluate() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] "
965966 "sourceCode:" << sourceCode << " fileName:" << fileName << "lineNumber:" << lineNumber;
966967 #endif
967− QMetaObject::invokeMethod(this, "evaluate", Qt::BlockingQueuedConnection,
968+ hifi::qt::blockingInvokeMethod(this, "evaluate",
968969 Q_RETURN_ARG(QScriptValue, result),
969970 Q_ARG(const QString&, sourceCode),
970971 Q_ARG(const QString&, fileName),