Permalink
Browse files

added: locks to addon manager

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29222 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
1 parent f6bc944 commit 4e5b98a30232b17f5ef3b66eb53dab1dad6c528b spiff_ committed Apr 13, 2010
Showing with 6 additions and 0 deletions.
  1. +4 −0 xbmc/addons/AddonManager.cpp
  2. +2 −0 xbmc/addons/AddonManager.h
@@ -128,6 +128,7 @@ bool CAddonMgr::GetAllAddons(VECADDONS &addons, bool enabledOnly/*= true*/)
bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, const CONTENT_TYPE &content/*= CONTENT_NONE*/, bool enabledOnly/*= true*/)
{
+ CSingleLock lock(m_critSection);
addons.clear();
if (m_addons.find(type) != m_addons.end())
{
@@ -149,6 +150,7 @@ bool CAddonMgr::GetAddons(const TYPE &type, VECADDONS &addons, const CONTENT_TYP
bool CAddonMgr::GetAddon(const CStdString &str, AddonPtr &addon, const TYPE &type/*=ADDON_UNKNOWN*/, bool enabledOnly/*= true*/)
{
+ CSingleLock lock(m_critSection);
if (type != ADDON_UNKNOWN && m_addons.find(type) == m_addons.end())
return false;
@@ -232,6 +234,7 @@ CStdString CAddonMgr::GetString(const CStdString &id, const int number)
void CAddonMgr::FindAddons()
{
+ CSingleLock lock(m_critSection);
// parse the user & system dirs for addons of the requested type
CFileItemList items;
if (!CSpecialProtocol::XBMCIsHome())
@@ -335,6 +338,7 @@ bool CAddonMgr::DependenciesMet(AddonPtr &addon)
if (!addon)
return false;
+ CSingleLock lock(m_critSection);
ADDONDEPS deps = addon->GetDeps();
ADDONDEPS::iterator itr = deps.begin();
while (itr != deps.end())
@@ -22,6 +22,7 @@
#include "Addon.h"
#include "include/xbmc_addon_dll.h"
#include "tinyXML/tinyxml.h"
+#include "utils/CriticalSection.h"
#include "StdString.h"
#include "DateTime.h"
#include "DownloadQueue.h"
@@ -98,6 +99,7 @@ namespace ADDON
MAPADDONS m_addons;
CDateTime m_lastDirScan;
std::map<CStdString, AddonPtr> m_idMap;
+ CCriticalSection m_critSection;
};
}; /* namespace ADDON */

0 comments on commit 4e5b98a

Please sign in to comment.