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 | 427 | if (isEvaluating()) { |
| 428 | 428 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); |
| 429 | 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 | 438 | // Wait for the scripting thread to stop running, as |
| @@ -449,9 +455,9 @@ void ScriptEngine::waitTillDoneRunning() { · 16 unmodified lines | ||
| 449 | 455 | qCWarning(scriptengine) << "Script Engine has been running too long, aborting:" << getFilename(); |
| 450 | 456 | abortEvaluation(); |
| 451 | 457 | } else { |
| 452 | − qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | |
| 453 | 458 | auto context = currentContext(); |
| 454 | 459 | if (context) { |
| 460 | + qCWarning(scriptengine) << "Script Engine has been running too long, throwing:" << getFilename(); | |
| 455 | 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 | 2215 | /**jsdoc |
| 2210 | 2216 | * Triggered when the script starts for a user. See also, {@link Script.entityScriptPreloadFinished}. |
| 2211 | 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 | 2219 | * @function Entities.preload |
| 2214 | 2220 | * @param {Uuid} entityID - The ID of the entity that the script is running in. |
| 2215 | 2221 | * @returns {Signal} |
| @@ -2415,7 +2421,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 199 unmodified lines | ||
| 2415 | 2421 | /**jsdoc |
| 2416 | 2422 | * Triggered when the script terminates for a user. |
| 2417 | 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 | 2425 | * @function Entities.unload |
| 2420 | 2426 | * @param {Uuid} entityID - The ID of the entity that the script is running in. |
| 2421 | 2427 | * @returns {Signal} |
| @@ -2475,13 +2481,14 @@ QList<EntityItemID> ScriptEngine::getListOfEntityScriptIDs() { · 53 unmodified lines | ||
| 2475 | 2481 | return _entityScripts.keys(); |
| 2476 | 2482 | } |
| 2477 | 2483 | |
| 2478 | −void ScriptEngine::unloadAllEntityScripts() { | |
| 2484 | +void ScriptEngine::unloadAllEntityScripts(bool blockingCall) { | |
| 2479 | 2485 | if (QThread::currentThread() != thread()) { |
| 2480 | 2486 | #ifdef THREAD_DEBUGGING |
| 2481 | 2487 | qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]"; |
| 2482 | 2488 | #endif |
| 2483 | 2489 | |
| 2484 | − QMetaObject::invokeMethod(this, "unloadAllEntityScripts"); | |
| 2490 | + QMetaObject::invokeMethod(this, "unloadAllEntityScripts", | |
| 2491 | + blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection); | |
| 2485 | 2492 | return; |
| 2486 | 2493 | } |
| 2487 | 2494 | #ifdef THREAD_DEBUGGING |