Merge branch 'master' of github.com:highfidelity/hifi into emojiAppAdd

This commit is contained in:
Zach Fox 2019-08-16 12:14:44 -07:00
commit c13697803d
5 changed files with 8 additions and 7 deletions

View file

@ -2761,7 +2761,6 @@ void Application::cleanupBeforeQuit() {
} }
getEntities()->shutdown(); // tell the entities system we're shutting down, so it will stop running scripts getEntities()->shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
getEntities()->clear();
// Clear any queued processing (I/O, FBX/OBJ/Texture parsing) // Clear any queued processing (I/O, FBX/OBJ/Texture parsing)
QThreadPool::globalInstance()->clear(); QThreadPool::globalInstance()->clear();

View file

@ -253,7 +253,7 @@ void EntityTreeRenderer::clear() {
// unload and stop the engine // unload and stop the engine
if (_entitiesScriptEngine) { if (_entitiesScriptEngine) {
// do this here (instead of in deleter) to avoid marshalling unload signals back to this thread // do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
_entitiesScriptEngine->unloadAllEntityScripts(); _entitiesScriptEngine->unloadAllEntityScripts(true);
_entitiesScriptEngine->stop(); _entitiesScriptEngine->stop();
} }

View file

@ -2470,13 +2470,14 @@ QList<EntityItemID> ScriptEngine::getListOfEntityScriptIDs() {
return _entityScripts.keys(); return _entityScripts.keys();
} }
void ScriptEngine::unloadAllEntityScripts() { void ScriptEngine::unloadAllEntityScripts(bool blockingCall) {
if (QThread::currentThread() != thread()) { if (QThread::currentThread() != thread()) {
#ifdef THREAD_DEBUGGING #ifdef THREAD_DEBUGGING
qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]"; qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]";
#endif #endif
QMetaObject::invokeMethod(this, "unloadAllEntityScripts"); QMetaObject::invokeMethod(this, "unloadAllEntityScripts",
blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection);
return; return;
} }
#ifdef THREAD_DEBUGGING #ifdef THREAD_DEBUGGING

View file

@ -578,9 +578,10 @@ public:
/**jsdoc /**jsdoc
* @function Script.unloadAllEntityScripts * @function Script.unloadAllEntityScripts
* @param {boolean} [blockingCall=false] - Wait for completion if call moved to another thread.
* @deprecated This function is deprecated and will be removed. * @deprecated This function is deprecated and will be removed.
*/ */
Q_INVOKABLE void unloadAllEntityScripts(); Q_INVOKABLE void unloadAllEntityScripts(bool blockingCall = false);
/**jsdoc /**jsdoc
* Calls a method in an entity script. * Calls a method in an entity script.

View file

@ -40,10 +40,10 @@ module.exports = {
response = { statusCode: httpRequest.status }; response = { statusCode: httpRequest.status };
} }
callback(error, response, optionalCallbackParameter);
// Break circular reference to httpRequest so the engine can garbage collect it. // Break circular reference to httpRequest so the engine can garbage collect it.
httpRequest.onreadystatechange = null; httpRequest.onreadystatechange = null;
callback(error, response, optionalCallbackParameter);
} }
}; };
if (typeof options === 'string') { if (typeof options === 'string') {