Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 4 files). Show all
Unified · Split
| @@ -223,10 +223,11 @@ ScriptEngine::ScriptEngine(Context context, const QString& scriptContents, const · 222 unmodified lines | |||
| 223 | if (_type == Type::ENTITY_CLIENT || _type == Type::ENTITY_SERVER) { | 223 | if (_type == Type::ENTITY_CLIENT || _type == Type::ENTITY_SERVER) { |
| 224 | QObject::connect(this, &ScriptEngine::update, this, [this]() { | 224 | QObject::connect(this, &ScriptEngine::update, this, [this]() { |
| 225 | // process pending entity script content | 225 | // process pending entity script content |
| 226 | if (_contentAvailableQueue.size()) { | 226 | if (!_contentAvailableQueue.empty()) { |
| 227 | auto pending = _contentAvailableQueue.values().toStdList(); | 227 | EntityScriptContentAvailableMap pending; |
| 228 | _contentAvailableQueue.clear(); | 228 | std::swap(_contentAvailableQueue, pending); |
| 229 | for (auto& args : pending) { | 229 | for (auto& pair : pending) { |
| 230 | auto& args = pair.second; | ||
| 230 | entityScriptContentAvailable(args.entityID, args.scriptOrURL, args.contents, args.isURL, args.success, args.status); | 231 | entityScriptContentAvailable(args.entityID, args.scriptOrURL, args.contents, args.isURL, args.success, args.status); |
| 231 | } | 232 | } |
| 232 | } | 233 | } |