diff options
author | Garrett Brown <themagnificentmrb@gmail.com> | 2018-03-15 16:56:55 -0700 |
---|---|---|
committer | Garrett Brown <themagnificentmrb@gmail.com> | 2018-03-30 10:32:14 -0700 |
commit | 201e2ce850f39c11aa740bfa9ec90c5375db667b (patch) | |
tree | 5d7c556fc0dcb01fc0809b99ceb3c8134a58f069 | |
parent | 2c49a7df7a551f54d48553936273e975360e65e5 (diff) |
Move CStereoscopicsManager init/deinit to CServiceManager
This part is tricky. Identify the closest stage where the instance is
initialized and move it to CServiceManager.
In this case, it was pretty easy. Init occurred right before Stage 3, so we
move it into CServiceManager at the top of Stage 3.
Notice how deinit is done at the same relative place in the opposite order.
Before, CStereoscopicsManager was never deinitialized, so adding a deinit
step in CServiceManager might cause crashes on shutdown. Regardless, we
must be strict in CServiceManager, so we'll have to deal with shutdown
crashes if any arise.
-rw-r--r-- | xbmc/Application.cpp | 2 | ||||
-rw-r--r-- | xbmc/ServiceManager.cpp | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index c983953241..7abd20fb77 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -1150,8 +1150,6 @@ bool CApplication::Initialize() // the startup window is considered part of the initialization as it most likely switches to the final window uiInitializationFinished = firstWindow != WINDOW_STARTUP_ANIM; - CStereoscopicsManager::GetInstance().Initialize(); - if (!m_ServiceManager->InitStageThree()) { CLog::Log(LOGERROR, "Application - Init3 failed"); diff --git a/xbmc/ServiceManager.cpp b/xbmc/ServiceManager.cpp index 5a09b61df6..412c37c48c 100644 --- a/xbmc/ServiceManager.cpp +++ b/xbmc/ServiceManager.cpp @@ -230,6 +230,9 @@ bool CServiceManager::StartAudioEngine() // stage 3 is called after successful initialization of WindowManager bool CServiceManager::InitStageThree() { + m_stereoscopicsManager.reset(new CStereoscopicsManager); + m_stereoscopicsManager->Initialize(); + // Peripherals depends on strings being loaded before stage 3 m_peripherals->Initialise(); @@ -258,6 +261,7 @@ void CServiceManager::DeinitStageThree() m_contextMenuManager->Deinit(); m_gameServices.reset(); m_peripherals->Clear(); + m_stereoscopicsManager.reset(); } void CServiceManager::DeinitStageTwo() |