Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f48d0b8f authored by Adam Lesinski's avatar Adam Lesinski Committed by android-build-merger
Browse files

Merge "[AssetManager]:Fix thread race caused double free issue."

am: 126e0220

Change-Id: I9928064b4811579bd50d4eeaff98bd4200b8bc7b
parents abc432fd 126e0220
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;
        }
    }