diff options
-rw-r--r-- | xbmc/addons/Addon.cpp | 7 | ||||
-rw-r--r-- | xbmc/addons/AddonDatabase.cpp | 7 | ||||
-rw-r--r-- | xbmc/addons/AddonDatabase.h | 3 | ||||
-rw-r--r-- | xbmc/addons/AddonInstaller.cpp | 3 | ||||
-rw-r--r-- | xbmc/addons/AddonManager.cpp | 8 | ||||
-rw-r--r-- | xbmc/addons/AddonManager.h | 3 |
6 files changed, 23 insertions, 8 deletions
diff --git a/xbmc/addons/Addon.cpp b/xbmc/addons/Addon.cpp index 248db56edf..d325d6bee6 100644 --- a/xbmc/addons/Addon.cpp +++ b/xbmc/addons/Addon.cpp @@ -726,13 +726,6 @@ void OnPreUnInstall(const AddonPtr& addon) if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_CONTEXT_ITEM)) CContextMenuManager::GetInstance().Unregister(std::static_pointer_cast<CContextMenuAddon>(localAddon)); - if (CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon, ADDON_REPOSITORY)) - { - CAddonDatabase database; - database.Open(); - database.DeleteRepository(addon->ID()); - } - addon->OnPreUnInstall(); } diff --git a/xbmc/addons/AddonDatabase.cpp b/xbmc/addons/AddonDatabase.cpp index f2a0083707..e33c7dae23 100644 --- a/xbmc/addons/AddonDatabase.cpp +++ b/xbmc/addons/AddonDatabase.cpp @@ -917,3 +917,10 @@ bool CAddonDatabase::IsSystemAddonRegistered(const std::string &addonID) } return false; } + +void CAddonDatabase::OnPostUnInstall(const std::string& addonId) +{ + DisableAddon(addonId, false); + RemoveAddonFromBlacklist(addonId); + DeleteRepository(addonId); +} diff --git a/xbmc/addons/AddonDatabase.h b/xbmc/addons/AddonDatabase.h index 021fb497dc..581bc751f4 100644 --- a/xbmc/addons/AddonDatabase.h +++ b/xbmc/addons/AddonDatabase.h @@ -157,6 +157,9 @@ public: */ bool IsSystemAddonRegistered(const std::string &addonID); + /*! Clear internal fields that shouldn't be kept around indefinitely */ + void OnPostUnInstall(const std::string& addonId); + protected: virtual void CreateTables(); virtual void CreateAnalytics(); diff --git a/xbmc/addons/AddonInstaller.cpp b/xbmc/addons/AddonInstaller.cpp index 65f0815735..22bc8fd76e 100644 --- a/xbmc/addons/AddonInstaller.cpp +++ b/xbmc/addons/AddonInstaller.cpp @@ -896,6 +896,9 @@ bool CAddonUnInstallJob::DoWork() addon = m_addon; CEventLog::GetInstance().Add(EventPtr(new CAddonManagementEvent(addon, 24144))); + CAddonMgr::GetInstance().OnPostUnInstall(m_addon->ID()); + database.OnPostUnInstall(m_addon->ID()); + ADDON::OnPostUnInstall(m_addon); return true; } diff --git a/xbmc/addons/AddonManager.cpp b/xbmc/addons/AddonManager.cpp index e00db87f0f..4d2793e356 100644 --- a/xbmc/addons/AddonManager.cpp +++ b/xbmc/addons/AddonManager.cpp @@ -646,7 +646,6 @@ void CAddonMgr::FindAddons() void CAddonMgr::UnregisterAddon(const std::string& ID) { CSingleLock lock(m_critSection); - m_disabled.erase(ID); if (m_cpluff && m_cp_context) { m_cpluff->uninstall_plugin(m_cp_context, ID.c_str()); @@ -656,6 +655,13 @@ void CAddonMgr::UnregisterAddon(const std::string& ID) } } +void CAddonMgr::OnPostUnInstall(const std::string& id) +{ + CSingleLock lock(m_critSection); + m_disabled.erase(id); + m_updateBlacklist.erase(id); +} + bool CAddonMgr::RemoveFromUpdateBlacklist(const std::string& id) { CSingleLock lock(m_critSection); diff --git a/xbmc/addons/AddonManager.h b/xbmc/addons/AddonManager.h index 1a0465251b..472a51ebea 100644 --- a/xbmc/addons/AddonManager.h +++ b/xbmc/addons/AddonManager.h @@ -112,6 +112,9 @@ namespace ADDON void FindAddons(); void UnregisterAddon(const std::string& ID); + /*! Hook for clearing internal state after uninstall. */ + void OnPostUnInstall(const std::string& id); + /*! \brief Disable an addon. Returns true on success, false on failure. */ bool DisableAddon(const std::string& ID); |