Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e022095
am: f48d0b8f19
Change-Id: Ia7da9ff37d813729a8c916a3b6e378110045aa17
This commit is contained in:
@ -1892,6 +1892,7 @@ ZipFileRO* AssetManager::SharedZip::getZip()
|
||||
|
||||
Asset* AssetManager::SharedZip::getResourceTableAsset()
|
||||
{
|
||||
AutoMutex _l(gLock);
|
||||
ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
|
||||
return mResourceTableAsset;
|
||||
}
|
||||
@ -1901,10 +1902,10 @@ Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset)
|
||||
{
|
||||
AutoMutex _l(gLock);
|
||||
if (mResourceTableAsset == NULL) {
|
||||
mResourceTableAsset = asset;
|
||||
// This is not thread safe the first time it is called, so
|
||||
// do it here with the global lock held.
|
||||
asset->getBuffer(true);
|
||||
mResourceTableAsset = asset;
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user