From e447b46a551cb5d13bd268e6e58351abcef67c29 Mon Sep 17 00:00:00 2001 From: CastagnaIT Date: Sun, 5 Jan 2020 17:46:52 +0100 Subject: [PATCH] Perform operations only outside the login screen --- xbmc/profiles/ProfileManager.cpp | 24 +++++++++++++++++------- xbmc/profiles/ProfileManager.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/xbmc/profiles/ProfileManager.cpp b/xbmc/profiles/ProfileManager.cpp index 8276aa484af6f..d92e6e92c25b4 100644 --- a/xbmc/profiles/ProfileManager.cpp +++ b/xbmc/profiles/ProfileManager.cpp @@ -79,6 +79,7 @@ static CProfile EmptyProfile; CProfileManager::CProfileManager() : m_usingLoginScreen(false), m_profileLoadedForLogin(false), + m_previousProfileLoadedForLogin(false), m_autoLoginProfile(-1), m_lastUsedProfile(0), m_currentProfile(0), @@ -248,6 +249,7 @@ void CProfileManager::Clear() CSingleLock lock(m_critical); m_usingLoginScreen = false; m_profileLoadedForLogin = false; + m_previousProfileLoadedForLogin = false; m_lastUsedProfile = 0; m_nextProfileId = 0; SetCurrentProfileId(0); @@ -299,7 +301,7 @@ bool CProfileManager::LoadProfile(unsigned int index) // save any settings of the currently used skin but only if the (master) // profile hasn't just been loaded as a temporary profile for login - if (g_SkinInfo != nullptr && !m_profileLoadedForLogin) + if (g_SkinInfo != nullptr && !m_previousProfileLoadedForLogin) g_SkinInfo->SaveSettings(); // @todo: why is m_settings not used here? @@ -309,7 +311,7 @@ bool CProfileManager::LoadProfile(unsigned int index) settings->Unload(); SetCurrentProfileId(index); - m_profileLoadedForLogin = false; + m_previousProfileLoadedForLogin = false; // load the new settings if (!settings->Load()) @@ -364,6 +366,8 @@ bool CProfileManager::LoadProfile(unsigned int index) UpdateCurrentProfileDate(); FinalizeLoadProfile(); + m_profileLoadedForLogin = false; + return true; } @@ -408,14 +412,17 @@ void CProfileManager::FinalizeLoadProfile() contextMenuManager.Init(); // Restart PVR services if we are not just loading the master profile for the login screen - if (m_profileLoadedForLogin || m_currentProfile != 0 || m_lastUsedProfile == 0) + if (m_previousProfileLoadedForLogin || m_currentProfile != 0 || m_lastUsedProfile == 0) pvrManager.Init(); favouritesManager.ReInit(GetProfileUserDataFolder()); - serviceAddons.Start(); - - g_application.UpdateLibraries(); + // Start these operations only when a profile is loaded, not on the login screen + if (!m_profileLoadedForLogin || (m_profileLoadedForLogin && m_lastUsedProfile == 0)) + { + serviceAddons.Start(); + g_application.UpdateLibraries(); + } stereoscopicsManager.Initialize(); @@ -610,10 +617,13 @@ void CProfileManager::LoadMasterProfileForLogin() m_lastUsedProfile = m_currentProfile; if (m_currentProfile != 0) { + // determines that the (master) profile has only been loaded for login + m_profileLoadedForLogin = true; + LoadProfile(0); // remember that the (master) profile has only been loaded for login - m_profileLoadedForLogin = true; + m_previousProfileLoadedForLogin = true; } } diff --git a/xbmc/profiles/ProfileManager.h b/xbmc/profiles/ProfileManager.h index 96a729817950d..c05a3d3b09e96 100644 --- a/xbmc/profiles/ProfileManager.h +++ b/xbmc/profiles/ProfileManager.h @@ -207,6 +207,7 @@ class CProfileManager : protected ISettingsHandler, std::vector m_profiles; bool m_usingLoginScreen; bool m_profileLoadedForLogin; + bool m_previousProfileLoadedForLogin; int m_autoLoginProfile; unsigned int m_lastUsedProfile; unsigned int m_currentProfile; // do not modify directly, use SetCurrentProfileId() function instead