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
814 }814 }
815 815
816 // Tell the plugin manager about our statically linked plugins816 // Tell the plugin manager about our statically linked plugins
817 DependencyManager::set<PluginManager>();
817 auto pluginManager = PluginManager::getInstance();818 auto pluginManager = PluginManager::getInstance();
818 pluginManager->setInputPluginProvider([] { return getInputPlugins(); });819 pluginManager->setInputPluginProvider([] { return getInputPlugins(); });
819 pluginManager->setDisplayPluginProvider([] { return getDisplayPlugins(); });820 pluginManager->setDisplayPluginProvider([] { return getDisplayPlugins(); });
@@ -1375,6 +1376,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 555 unmodified lines
1375 initializeRenderEngine();1376 initializeRenderEngine();
1376 qCDebug(interfaceapp, "Initialized Render Engine.");1377 qCDebug(interfaceapp, "Initialized Render Engine.");
1377 1378
1379 // Overlays need to exist before we set the ContextOverlayInterface dependency
1380 _overlays.init(); // do this before scripts load
1381 DependencyManager::set<ContextOverlayInterface>();
1382
1378 // Initialize the user interface and menu system1383 // Initialize the user interface and menu system
1379 // Needs to happen AFTER the render engine initialization to access its configuration1384 // Needs to happen AFTER the render engine initialization to access its configuration
1380 initializeUi();1385 initializeUi();
@@ -1511,10 +1516,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 130 unmodified lines
1511 // allow you to move an entity around in your hand1516 // allow you to move an entity around in your hand
1512 _entityEditSender.setPacketsPerSecond(3000); // super high!!1517 _entityEditSender.setPacketsPerSecond(3000); // super high!!
1513 1518
1514 // Overlays need to exist before we set the ContextOverlayInterface dependency
1515 _overlays.init(); // do this before scripts load
1516 DependencyManager::set<ContextOverlayInterface>();
1517
1518 // Make sure we don't time out during slow operations at startup1519 // Make sure we don't time out during slow operations at startup
1519 updateHeartbeat();1520 updateHeartbeat();
1520 1521
@@ -2552,12 +2553,18 @@ Application::~Application() { · 1031 unmodified lines
2552 _octreeProcessor.terminate();2553 _octreeProcessor.terminate();
2553 _entityEditSender.terminate();2554 _entityEditSender.terminate();
2554 2555
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
2555 DependencyManager::destroy<AvatarManager>();2563 DependencyManager::destroy<AvatarManager>();
2556 DependencyManager::destroy<AnimationCache>();2564 DependencyManager::destroy<AnimationCache>();
2557 DependencyManager::destroy<FramebufferCache>();2565 DependencyManager::destroy<FramebufferCache>();
2558 DependencyManager::destroy<TextureCache>();2566 DependencyManager::destroy<TextureCache>();
2559 DependencyManager::destroy<ModelCache>();2567 DependencyManager::destroy<ModelCache>();
2560 DependencyManager::destroy<GeometryCache>();
2561 DependencyManager::destroy<ScriptCache>();2568 DependencyManager::destroy<ScriptCache>();
2562 DependencyManager::destroy<SoundCache>();2569 DependencyManager::destroy<SoundCache>();
2563 DependencyManager::destroy<OctreeStatsProvider>();2570 DependencyManager::destroy<OctreeStatsProvider>();
@@ -2567,10 +2574,6 @@ Application::~Application() { · 3 unmodified lines
2567 // remove the NodeList from the DependencyManager2574 // remove the NodeList from the DependencyManager
2568 DependencyManager::destroy<NodeList>();2575 DependencyManager::destroy<NodeList>();
2569 2576
2570 if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) {
2571 steamClient->shutdown();
2572 }
2573
2574#if 02577#if 0
2575 ConnexionClient::getInstance().destroy();2578 ConnexionClient::getInstance().destroy();
2576#endif2579#endif
@@ -2890,6 +2893,7 @@ void Application::initializeUi() { · 313 unmodified lines
2890 auto compositorHelper = DependencyManager::get<CompositorHelper>();2893 auto compositorHelper = DependencyManager::get<CompositorHelper>();
2891 connect(compositorHelper.data(), &CompositorHelper::allowMouseCaptureChanged, this, [=] {2894 connect(compositorHelper.data(), &CompositorHelper::allowMouseCaptureChanged, this, [=] {
2892 if (isHMDMode()) {2895 if (isHMDMode()) {
2896 auto compositorHelper = DependencyManager::get<CompositorHelper>(); // don't capture outer smartpointer
2893 showCursor(compositorHelper->getAllowMouseCapture() ?2897 showCursor(compositorHelper->getAllowMouseCapture() ?
2894 Cursor::Manager::lookupIcon(_preferredCursor.get()) :2898 Cursor::Manager::lookupIcon(_preferredCursor.get()) :
2895 Cursor::Icon::SYSTEM);2899 Cursor::Icon::SYSTEM);