Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e022095 am: f48d0b8f19

am: 73b91c63ad

Change-Id: I27f5cc6106f0a8f0a58721e1e8ed836144347b6a
This commit is contained in:
Adam Lesinski
2016-10-03 20:26:41 +00:00
committed by android-build-merger

View File

@@ -1893,6 +1893,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;
}
@@ -1902,10 +1903,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;
}
}