Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid incorrect disabling PVR addons #4757

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion xbmc/addons/AddonDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ int CAddonDatabase::AddAddon(const AddonPtr& addon,
if (NULL == m_pDB.get()) return -1;
if (NULL == m_pDS.get()) return -1;

bool bDisablePVRAddon = addon->Type() == ADDON_PVRDLL && !HasAddon(addon->ID());
bool bDisablePVRAddon = addon->Type() == ADDON_PVRDLL && !CAddonMgr::Get().HasAddon(addon->ID());

CStdString sql = PrepareSQL("insert into addon (id, type, name, summary,"
"description, stars, path, icon, changelog, "
Expand Down
16 changes: 16 additions & 0 deletions xbmc/addons/AddonManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,22 @@ bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, bool enabled /* =
return addons.size() > 0;
}

bool CAddonMgr::HasAddon(const CStdString& id)
{
bool retval;
cp_status_t status;
cp_plugin_info_t* cpaddon;
CSingleLock lock(m_critSection);

cpaddon = m_cpluff->get_plugin_info(m_cp_context, id.c_str(), &status);
retval = (status == CP_OK && cpaddon);

if (cpaddon)
m_cpluff->release_info(m_cp_context, cpaddon);

return retval;
}

bool CAddonMgr::GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type/*=ADDON_UNKNOWN*/, bool enabledOnly /*= true*/)
{
CSingleLock lock(m_critSection);
Expand Down
1 change: 1 addition & 0 deletions xbmc/addons/AddonManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace ADDON
\param enabledOnly whether we only want enabled addons - set to false to allow both enabled and disabled addons - defaults to true.
\return true if an addon matching the id of the given type is available and is enabled (if enabledOnly is true).
*/
bool HasAddon(const CStdString& id);
bool GetAddon(const CStdString &id, AddonPtr &addon, const TYPE &type = ADDON_UNKNOWN, bool enabledOnly = true);
bool HasAddons(const TYPE &type, bool enabled = true);
bool GetAddons(const TYPE &type, VECADDONS &addons, bool enabled = true);
Expand Down