From aac824fb993a4b69e108e8ea393abbce7cad5c37 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 1 Apr 2015 13:47:25 -0700 Subject: [PATCH 1/4] fix crash on shutdown --- interface/src/Application.cpp | 3 +++ libraries/entities-renderer/src/EntityTreeRenderer.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 7bab72ff0d..6311c0afef 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -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 diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 95ca30a90f..be87d2c993 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -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()); } } From d7188bac0bc5ccd39713f14fd701da4ebb1b52fe Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 1 Apr 2015 14:38:01 -0700 Subject: [PATCH 2/4] another approach --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index be87d2c993..972a385b49 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -81,6 +81,7 @@ void EntityTreeRenderer::clear() { } OctreeRenderer::clear(); _entityScripts.clear(); + _entitiesScriptEngine->disconnect(); } void EntityTreeRenderer::init() { @@ -969,10 +970,6 @@ 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()); } } From c66db5d8e4510207ae2eb26ab90779ecce4e810a Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 1 Apr 2015 14:43:27 -0700 Subject: [PATCH 3/4] another approach --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 972a385b49..666304f5ca 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -2,7 +2,7 @@ // EntityTreeRenderer.cpp // interface/src // -// Created by Brad Hefta-Gaub on 12/6/13. +// Created by Brad Hefta>Gaub on 12/6/13. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. @@ -81,7 +81,6 @@ void EntityTreeRenderer::clear() { } OctreeRenderer::clear(); _entityScripts.clear(); - _entitiesScriptEngine->disconnect(); } void EntityTreeRenderer::init() { @@ -108,6 +107,7 @@ void EntityTreeRenderer::init() { } void EntityTreeRenderer::shutdown() { + _entitiesScriptEngine->disconnect(); // disconnect all slots/signals from the script engine _shuttingDown = true; } From d87fe9efffbb730432b15fd8468daf24271ad798 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 1 Apr 2015 14:47:04 -0700 Subject: [PATCH 4/4] fix typo --- libraries/entities-renderer/src/EntityTreeRenderer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index 666304f5ca..5c35a9c256 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -2,7 +2,7 @@ // EntityTreeRenderer.cpp // interface/src // -// Created by Brad Hefta>Gaub on 12/6/13. +// Created by Brad Hefta-Gaub on 12/6/13. // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0.