History

fix various crashes-upon-exits

Seth Alves committed 8 years ago

Commit dcebbad1 parent 0c9f0cb6 files · +36 −17Browse files

Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all

Unified · Split

interface/src/Application.cpp+13−9
@@ -814,6 +814,7 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 813 unmodified lines
814814 }
815815
816816 // Tell the plugin manager about our statically linked plugins
817+ DependencyManager::set<PluginManager>();
817818 auto pluginManager = PluginManager::getInstance();
818819 pluginManager->setInputPluginProvider([] { return getInputPlugins(); });
819820 pluginManager->setDisplayPluginProvider([] { return getDisplayPlugins(); });
@@ -1375,6 +1376,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 555 unmodified lines
13751376 initializeRenderEngine();
13761377 qCDebug(interfaceapp, "Initialized Render Engine.");
13771378
1379+ // Overlays need to exist before we set the ContextOverlayInterface dependency
1380+ _overlays.init(); // do this before scripts load
1381+ DependencyManager::set<ContextOverlayInterface>();
1382+
13781383 // Initialize the user interface and menu system
13791384 // Needs to happen AFTER the render engine initialization to access its configuration
13801385 initializeUi();
@@ -1511,10 +1516,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 130 unmodified lines
15111516 // allow you to move an entity around in your hand
15121517 _entityEditSender.setPacketsPerSecond(3000); // super high!!
15131518
1514− // Overlays need to exist before we set the ContextOverlayInterface dependency
1515− _overlays.init(); // do this before scripts load
1516− DependencyManager::set<ContextOverlayInterface>();
1517−
15181519 // Make sure we don't time out during slow operations at startup
15191520 updateHeartbeat();
15201521
@@ -2552,12 +2553,18 @@ Application::~Application() { · 1031 unmodified lines
25522553 _octreeProcessor.terminate();
25532554 _entityEditSender.terminate();
25542555
2556+ if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
2557+ steamClient->shutdown();
2558+ }
2559+ DependencyManager::destroy<PluginManager>();
2560+
2561+ DependencyManager::destroy<CompositorHelper>(); // must be destroyed before the FramebufferCache
2562+
25552563 DependencyManager::destroy<AvatarManager>();
25562564 DependencyManager::destroy<AnimationCache>();
25572565 DependencyManager::destroy<FramebufferCache>();
25582566 DependencyManager::destroy<TextureCache>();
25592567 DependencyManager::destroy<ModelCache>();
2560− DependencyManager::destroy<GeometryCache>();
25612568 DependencyManager::destroy<ScriptCache>();
25622569 DependencyManager::destroy<SoundCache>();
25632570 DependencyManager::destroy<OctreeStatsProvider>();
@@ -2567,10 +2574,6 @@ Application::~Application() { · 3 unmodified lines
25672574 // remove the NodeList from the DependencyManager
25682575 DependencyManager::destroy<NodeList>();
25692576
2570− if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
2571− steamClient->shutdown();
2572− }
2573−
25742577 #if 0
25752578 ConnexionClient::getInstance().destroy();
25762579 #endif
@@ -2890,6 +2893,7 @@ void Application::initializeUi() { · 313 unmodified lines
28902893 auto compositorHelper = DependencyManager::get<CompositorHelper>();
28912894 connect(compositorHelper.data(), &CompositorHelper::allowMouseCaptureChanged, this, [=] {
28922895 if (isHMDMode()) {
2896+ auto compositorHelper = DependencyManager::get<CompositorHelper>(); // don't capture outer smartpointer
28932897 showCursor(compositorHelper->getAllowMouseCapture() ?
28942898 Cursor::Manager::lookupIcon(_preferredCursor.get()) :
28952899 Cursor::Icon::SYSTEM);