From 73097113c7469d31948c3b1acf2d0af1cc8a6a94 Mon Sep 17 00:00:00 2001 From: amer cerkic Date: Wed, 10 Jul 2019 17:13:34 -0700 Subject: [PATCH 1/6] adding a null check to the display plugin. Possible that display plugin was disposed off during the check if hmdmode --- .../display-plugins/AbstractHMDScriptingInterface.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp b/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp index d068bef3b0..81e196e5ad 100644 --- a/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp +++ b/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp @@ -47,5 +47,12 @@ void AbstractHMDScriptingInterface::setIPDScale(float IPDScale) { } bool AbstractHMDScriptingInterface::isHMDMode() const { - return PluginContainer::getInstance().getActiveDisplayPlugin()->isHmd(); + + auto displayPlugin = PluginContainer::getInstance().getActiveDisplayPlugin(); + + if (displayPlugin) { + return displayPlugin->isHmd(); + } + + return false; } From d5d5741d42c5181c503ff7646409fd0de67b9923 Mon Sep 17 00:00:00 2001 From: amer cerkic Date: Wed, 10 Jul 2019 17:17:53 -0700 Subject: [PATCH 2/6] removed extra lines --- .../src/display-plugins/AbstractHMDScriptingInterface.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp b/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp index 81e196e5ad..4515a28997 100644 --- a/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp +++ b/libraries/display-plugins/src/display-plugins/AbstractHMDScriptingInterface.cpp @@ -47,12 +47,9 @@ void AbstractHMDScriptingInterface::setIPDScale(float IPDScale) { } bool AbstractHMDScriptingInterface::isHMDMode() const { - auto displayPlugin = PluginContainer::getInstance().getActiveDisplayPlugin(); - if (displayPlugin) { return displayPlugin->isHmd(); } - return false; -} +} \ No newline at end of file From efccd10a65a9a4ae013a491b8ef31e0024a7314f Mon Sep 17 00:00:00 2001 From: amer cerkic Date: Thu, 11 Jul 2019 12:15:15 -0700 Subject: [PATCH 3/6] adding a destroy call to hmd scripting interface to ensure that it does not call isHmd mode on already dead display plugin. Also moved displayplugin reset below ui destroy calls to make sure it does not get called after its been destroyed --- interface/src/Application.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3085f1ed2a..3310454b8c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2772,7 +2772,8 @@ void Application::cleanupBeforeQuit() { DependencyManager::get()->removeAccountFromFile(); } - _displayPlugin.reset(); + DependencyManager::destroy(); + PluginManager::getInstance()->shutdown(); // Cleanup all overlays after the scripts, as scripts might add more @@ -2810,6 +2811,8 @@ void Application::cleanupBeforeQuit() { DependencyManager::destroy(); + _displayPlugin.reset(); + _snapshotSoundInjector = nullptr; // destroy Audio so it and its threads have a chance to go down safely From 15e7663ed5b9fbdba5ea4b0423dfd335ce0284e1 Mon Sep 17 00:00:00 2001 From: amer cerkic Date: Thu, 11 Jul 2019 14:27:41 -0700 Subject: [PATCH 4/6] removing the destroy call since its not necessary --- interface/src/Application.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 3310454b8c..abcafd5a3e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2772,8 +2772,6 @@ void Application::cleanupBeforeQuit() { DependencyManager::get()->removeAccountFromFile(); } - DependencyManager::destroy(); - PluginManager::getInstance()->shutdown(); // Cleanup all overlays after the scripts, as scripts might add more From f78c1cb5d08cd4719e62c596ad5b6b138f4d2656 Mon Sep 17 00:00:00 2001 From: amerhifi Date: Fri, 12 Jul 2019 10:54:08 -0700 Subject: [PATCH 5/6] reverting display plugin reset change --- interface/src/Application.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index abcafd5a3e..e09819c11c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2772,6 +2772,7 @@ void Application::cleanupBeforeQuit() { DependencyManager::get()->removeAccountFromFile(); } + _displayPlugin.reset(); PluginManager::getInstance()->shutdown(); // Cleanup all overlays after the scripts, as scripts might add more @@ -2806,11 +2807,8 @@ void Application::cleanupBeforeQuit() { DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); - DependencyManager::destroy(); - _displayPlugin.reset(); - _snapshotSoundInjector = nullptr; // destroy Audio so it and its threads have a chance to go down safely From ba6307e8e4330b30ae62114e26a87bc9a2be782b Mon Sep 17 00:00:00 2001 From: amerhifi Date: Fri, 12 Jul 2019 10:55:44 -0700 Subject: [PATCH 6/6] revert of extra space --- interface/src/Application.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e09819c11c..8ec1577915 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2807,6 +2807,7 @@ void Application::cleanupBeforeQuit() { DependencyManager::destroy(); DependencyManager::destroy(); DependencyManager::destroy(); + DependencyManager::destroy(); _snapshotSoundInjector = nullptr;