diff options
author | Dave Blake <oak99sky@yahoo.co.uk> | 2020-01-26 10:34:47 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-26 10:34:47 +0000 |
commit | 4a590f583df1c675a8d92b5a30af5c13e601d1ad (patch) | |
tree | b7bfc35ff71e872a0d38efdf541c1c9bd56a1671 | |
parent | 9091a840ebb8e3f412728ba3ed3e3cedab10194b (diff) | |
parent | e447b46a551cb5d13bd268e6e58351abcef67c29 (diff) |
Merge pull request #17141 from CastagnaIT/leia_profileloads
[Backport][Profiles] Perform operations only outside the login screen
-rw-r--r-- | xbmc/profiles/ProfileManager.cpp | 24 | ||||
-rw-r--r-- | 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 8276aa484a..d92e6e92c2 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 96a7298179..c05a3d3b09 100644 --- a/xbmc/profiles/ProfileManager.h +++ b/xbmc/profiles/ProfileManager.h @@ -207,6 +207,7 @@ private: std::vector<CProfile> 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 |