make it thread safe

This commit is contained in:
yangxiao 2014-12-19 10:20:37 +08:00
parent 549ec2adab
commit 37f4d67a49
1 changed files with 5 additions and 14 deletions

View File

@ -146,24 +146,15 @@ void getChildMap(std::map<int, std::vector<int> >& map, SkinData* skinData, cons
}
}
Bundle3D* Bundle3D::_instance = nullptr;
void Bundle3D::setBundleInstance(Bundle3D* bundleInstance)
Bundle3D* Bundle3D::createBundle()
{
CC_SAFE_DELETE(_instance);
_instance = bundleInstance;
auto bundle = new (std::nothrow) Bundle3D();
return bundle;
}
Bundle3D* Bundle3D::getInstance()
void Bundle3D::destroyBundle(Bundle3D* bundle)
{
if (_instance == nullptr)
_instance = new (std::nothrow) Bundle3D();
return _instance;
}
void Bundle3D::destroyInstance()
{
CC_SAFE_DELETE(_instance);
delete bundle;
}
void Bundle3D::clear()