fix crash on shutdown

This commit is contained in:
ZappoMan 2015-04-01 13:47:25 -07:00
parent 4ec1d304e0
commit aac824fb99
2 changed files with 7 additions and 0 deletions

View file

@ -566,6 +566,9 @@ void Application::aboutToQuit() {
}
void Application::cleanupBeforeQuit() {
_entities.clear(); // this will allow entity scripts to properly shutdown
_datagramProcessor->shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts

View file

@ -969,6 +969,10 @@ void EntityTreeRenderer::checkAndCallUnload(const EntityItemID& entityID) {
QScriptValueList entityArgs = createEntityArgs(entityID);
entityScript.property("unload").call(entityScript, entityArgs);
}
// In the event that the entity script connected to any of our signals
// we want to disconnect it so we don't have anything dangling
_entitiesScriptEngine->disconnect(entityScript.toQObject());
}
}