Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

changed: matched other singelton calls

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@29837 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information...
commit 47a81965e4688d6130779daf809c248b7fea0bbc 1 parent ff73647
alcoheca authored
Showing with 9 additions and 10 deletions.
  1. +3 −7 xbmc/addons/AddonManager.cpp
  2. +6 −3 xbmc/addons/AddonManager.h
View
10 xbmc/addons/AddonManager.cpp
@@ -101,14 +101,10 @@ CAddonMgr::~CAddonMgr()
m_cpluff->destroy();
}
-CAddonMgr* CAddonMgr::Get()
+CAddonMgr &CAddonMgr::Get()
{
- if (!m_pInstance)
- {
- m_pInstance = new CAddonMgr();
- m_pInstance->Init();
- }
- return m_pInstance;
+ static CAddonMgr sAddonMgr;
+ return sAddonMgr;
}
IAddonMgrCallback* CAddonMgr::GetCallbackForType(TYPE type)
View
9 xbmc/addons/AddonManager.h
@@ -73,9 +73,8 @@ namespace ADDON
class CAddonMgr : public IJobCallback
{
public:
- static CAddonMgr* Get();
+ static CAddonMgr &Get();
bool Init();
- virtual ~CAddonMgr();
IAddonMgrCallback* GetCallbackForType(TYPE type);
bool RegisterAddonMgrCallback(TYPE type, IAddonMgrCallback* cb);
@@ -121,8 +120,12 @@ namespace ADDON
bool DependenciesMet(AddonPtr &addon);
bool UpdateIfKnown(AddonPtr &addon);
+ // private construction, and no assignements; use the provided singleton methods
CAddonMgr();
- static CAddonMgr* m_pInstance;
+ CAddonMgr(const CAddonMgr&);
+ CAddonMgr const& operator=(CAddonMgr const&);
+ virtual ~CAddonMgr();
+
static std::map<TYPE, IAddonMgrCallback*> m_managers;
MAPADDONS m_addons;
CStopWatch m_watch;
Please sign in to comment.
Something went wrong with that request. Please try again.