diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2017-01-25 22:20:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-25 22:20:24 +0100 |
commit | a02f481efc91cde504c72de3559aad21df1cd4c3 (patch) | |
tree | 2e4a4e6133a70a41af02d13dd3202532ed872fd8 | |
parent | 9a2281350bca859242c85fde3539363269117d04 (diff) | |
parent | bf116c14a239e71c4a666ace495239461c336b3e (diff) |
Merge pull request #11542 from ksooo/krypton-pvr-fix-addon-update
[PVR][application] Krypton: Fix update of PVR client addons
-rw-r--r-- | xbmc/Application.cpp | 6 | ||||
-rw-r--r-- | xbmc/addons/PVRClient.cpp | 21 | ||||
-rw-r--r-- | xbmc/addons/PVRClient.h | 6 | ||||
-rw-r--r-- | xbmc/pvr/addons/PVRClients.cpp | 7 |
4 files changed, 37 insertions, 3 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 1fe4a77d99..c6ef0c0e08 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -960,6 +960,10 @@ bool CApplication::InitDirectoriesOSX() else userHome = "/root"; + std::string binaddonAltDir; + if (getenv("KODI_BINADDON_PATH")) + binaddonAltDir = getenv("KODI_BINADDON_PATH"); + std::string appPath = CUtil::GetHomePath(); setenv("KODI_HOME", appPath.c_str(), 0); @@ -978,6 +982,7 @@ bool CApplication::InitDirectoriesOSX() { // map our special drives CSpecialProtocol::SetXBMCBinPath(appPath); + CSpecialProtocol::SetXBMCAltBinAddonPath(binaddonAltDir); CSpecialProtocol::SetXBMCPath(appPath); #if defined(TARGET_DARWIN_IOS) std::string appName = CCompileInfo::GetAppName(); @@ -1015,6 +1020,7 @@ bool CApplication::InitDirectoriesOSX() URIUtils::AddSlashAtEnd(appPath); CSpecialProtocol::SetXBMCBinPath(appPath); + CSpecialProtocol::SetXBMCAltBinAddonPath(binaddonAltDir); CSpecialProtocol::SetXBMCPath(appPath); CSpecialProtocol::SetHomePath(URIUtils::AddFileToFolder(appPath, "portable_data")); CSpecialProtocol::SetMasterProfilePath(URIUtils::AddFileToFolder(appPath, "portable_data/userdata")); diff --git a/xbmc/addons/PVRClient.cpp b/xbmc/addons/PVRClient.cpp index d85a00dd75..1ab7381fb6 100644 --- a/xbmc/addons/PVRClient.cpp +++ b/xbmc/addons/PVRClient.cpp @@ -101,6 +101,24 @@ void CPVRClient::OnEnabled() CPVRManager::GetInstance().Clients()->UpdateAddons(); } +void CPVRClient::StopRunningInstance() +{ + const ADDON::AddonPtr addon(GetRunningInstance()); + if (addon) + { + // stop the pvr manager and stop and unload the running pvr addon + PVR::CPVRManager::GetInstance().Stop(); + CPVRManager::GetInstance().Clients()->StopClient(addon, false); + } +} + +void CPVRClient::OnPreInstall() +{ + // note: this method is also called on update; thus stop and unload possibly running instance + StopRunningInstance(); + CAddon::OnPreInstall(); +} + void CPVRClient::OnPostInstall(bool update, bool modal) { CAddon::OnPostInstall(update, modal); @@ -109,8 +127,7 @@ void CPVRClient::OnPostInstall(bool update, bool modal) void CPVRClient::OnPreUnInstall() { - // stop the pvr manager, so running pvr add-ons are stopped and closed - PVR::CPVRManager::GetInstance().Stop(); + StopRunningInstance(); CAddon::OnPreUnInstall(); } diff --git a/xbmc/addons/PVRClient.h b/xbmc/addons/PVRClient.h index 8262ed58e2..1f3a47c601 100644 --- a/xbmc/addons/PVRClient.h +++ b/xbmc/addons/PVRClient.h @@ -72,6 +72,7 @@ namespace PVR virtual void OnDisabled() override; virtual void OnEnabled() override; + virtual void OnPreInstall() override; virtual void OnPostInstall(bool update, bool modal) override; virtual void OnPreUnInstall() override; virtual void OnPostUnInstall() override; @@ -706,6 +707,11 @@ namespace PVR */ bool CanPlayChannel(const CPVRChannelPtr &channel) const; + /*! + * @brief Stop this instance, if it is currently running. + */ + void StopRunningInstance(); + bool LogError(const PVR_ERROR error, const char *strMethod) const; void LogException(const std::exception &e, const char *strFunctionName) const; diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index 968862646a..7fea6d32ae 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -220,8 +220,13 @@ bool CPVRClients::StopClient(AddonPtr client, bool bRestart) if (bRestart) mappedClient->ReCreate(); else - mappedClient->Destroy(); + { + const auto it = m_clientMap.find(iId); + if (it != m_clientMap.end()) + m_clientMap.erase(it); + mappedClient->Destroy(); + } return true; } |