Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 2 files). Show all
Unified · Split
| @@ -1214,16 +1214,19 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 1213 unmodified lines | ||
| 1214 | 1214 | QString contents = data[url]; |
| 1215 | 1215 | if (contents.isNull()) { |
| 1216 | 1216 | qCDebug(scriptengine) << "Error loading file: " << url << "line:" << __LINE__; |
| 1217 | − } else if (!_includedURLs.contains(url)) { | |
| 1218 | − _includedURLs << url; | |
| 1219 | − // Set the parent url so that path resolution will be relative | |
| 1220 | − // to this script's url during its initial evaluation | |
| 1221 | − _parentURL = url.toString(); | |
| 1222 | − auto operation = [&]() { | |
| 1223 | − evaluate(contents, url.toString()); | |
| 1224 | − }; | |
| 1225 | − | |
| 1226 | − doWithEnvironment(capturedEntityIdentifier, capturedSandboxURL, operation); | |
| 1217 | + } else { | |
| 1218 | + std::lock_guard<std::recursive_mutex> lock(_lock); | |
| 1219 | + if (!_includedURLs.contains(url)) { | |
| 1220 | + _includedURLs << url; | |
| 1221 | + // Set the parent url so that path resolution will be relative | |
| 1222 | + // to this script's url during its initial evaluation | |
| 1223 | + _parentURL = url.toString(); | |
| 1224 | + auto operation = [&]() { | |
| 1225 | + evaluate(contents, url.toString()); | |
| 1226 | + }; | |
| 1227 | + | |
| 1228 | + doWithEnvironment(capturedEntityIdentifier, capturedSandboxURL, operation); | |
| 1229 | + } | |
| 1227 | 1230 | } |
| 1228 | 1231 | } |
| 1229 | 1232 | _parentURL = parentURL; |