Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1529 files). Show all
Unified · Split
| @@ -427,6 +427,12 @@ void ScriptEngine::waitTillDoneRunning() { · 426 unmodified lines | |||
| 427 | if (isEvaluating()) { | 427 | if (isEvaluating()) { |
| 428 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); | 428 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); |
| 429 | abortEvaluation(); | 429 | abortEvaluation(); |
| 430 | } else { | ||
| 431 | auto context = currentContext(); | ||
| 432 | if (context) { | ||
| 433 | qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | ||
| 434 | context->throwError("Timed out during shutdown"); | ||
| 435 | } | ||
| 430 | } | 436 | } |
| 431 | 437 | ||
| 432 | // Wait for the scripting thread to stop running, as | 438 | // Wait for the scripting thread to stop running, as |
| @@ -449,9 +455,9 @@ void ScriptEngine::waitTillDoneRunning() { · 16 unmodified lines | |||
| 449 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); | 455 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); |
| 450 | abortEvaluation(); | 456 | abortEvaluation(); |
| 451 | } else { | 457 | } else { |
| 452 | qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | ||
| 453 | auto context = currentContext(); | 458 | auto context = currentContext(); |
| 454 | if (context) { | 459 | if (context) { |
| 460 | qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | ||
| 455 | context->throwError("Timed out during shutdown"); | 461 | context->throwError("Timed out during shutdown"); |
| 456 | } | 462 | } |
| 457 | } | 463 | } |
| @@ -2209,7 +2215,7 @@ void ScriptEngine::loadEntityScript(const EntityItemID& entityID, const QString& · 1751 unmodified lines | |||
| 2209 | /**jsdoc | 2215 | /**jsdoc |
| 2210 | * Triggered when the script starts for a user. See also, {@link Script.entityScriptPreloadFinished}. | 2216 | * Triggered when the script starts for a user. See also, {@link Script.entityScriptPreloadFinished}. |
| 2211 | * <p>Note: Can only be connected to via <code>this.preload = function (...) { ... }</code> in the entity script.</p> | 2217 | * <p>Note: Can only be connected to via <code>this.preload = function (...) { ... }</code> in the entity script.</p> |
| 2212 | * <table><tr><th>Available in:</th><td>Client Entity Scripts</td><td>Server Entity Scripts</td></tr></table> | 2218 | * <p class="availableIn"><strong>Supported Script Types:</strong> Client Entity Scripts • Server Entity Scripts</p> |
| 2213 | * @function Entities.preload | 2219 | * @function Entities.preload |
| 2214 | * @param {Uuid} entityID - The ID of the entity that the script is running in. | 2220 | * @param {Uuid} entityID - The ID of the entity that the script is running in. |
| 2215 | * @returns {Signal} | 2221 | * @returns {Signal} |
| @@ -2415,7 +2421,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 199 unmodified lines | |||
| 2415 | /**jsdoc | 2421 | /**jsdoc |
| 2416 | * Triggered when the script terminates for a user. | 2422 | * Triggered when the script terminates for a user. |
| 2417 | * <p>Note: Can only be connected to via <code>this.unoad = function () { ... }</code> in the entity script.</p> | 2423 | * <p>Note: Can only be connected to via <code>this.unoad = function () { ... }</code> in the entity script.</p> |
| 2418 | * <table><tr><th>Available in:</th><td>Client Entity Scripts</td><td>Server Entity Scripts</td></tr></table> | 2424 | * <p class="availableIn"><strong>Supported Script Types:</strong> Client Entity Scripts • Server Entity Scripts</p> |
| 2419 | * @function Entities.unload | 2425 | * @function Entities.unload |
| 2420 | * @param {Uuid} entityID - The ID of the entity that the script is running in. | 2426 | * @param {Uuid} entityID - The ID of the entity that the script is running in. |
| 2421 | * @returns {Signal} | 2427 | * @returns {Signal} |
| @@ -2475,13 +2481,14 @@ QList<EntityItemID> ScriptEngine::getListOfEntityScriptIDs() { · 53 unmodified lines | |||
| 2475 | return _entityScripts.keys(); | 2481 | return _entityScripts.keys(); |
| 2476 | } | 2482 | } |
| 2477 | 2483 | ||
| 2478 | void ScriptEngine::unloadAllEntityScripts() { | 2484 | void ScriptEngine::unloadAllEntityScripts(bool blockingCall) { |
| 2479 | if (QThread::currentThread() != thread()) { | 2485 | if (QThread::currentThread() != thread()) { |
| 2480 | #ifdef THREAD_DEBUGGING | 2486 | #ifdef THREAD_DEBUGGING |
| 2481 | qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]"; | 2487 | qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]"; |
| 2482 | #endif | 2488 | #endif |
| 2483 | 2489 | ||
| 2484 | QMetaObject::invokeMethod(this, "unloadAllEntityScripts"); | 2490 | QMetaObject::invokeMethod(this, "unloadAllEntityScripts", |
| 2491 | blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection); | ||
| 2485 | return; | 2492 | return; |
| 2486 | } | 2493 | } |
| 2487 | #ifdef THREAD_DEBUGGING | 2494 | #ifdef THREAD_DEBUGGING |