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

Commit dbfd183f 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:...

Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e0220 am: f48d0b8f am: 73b91c63
am: 224ffd3c

Change-Id: Id06724e9d44464d1599743741d73b5bd9c282ff2
parents 8db93d86 224ffd3c
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -1837,6 +1837,7 @@ ZipFileRO* AssetManager::SharedZip::getZip()


Asset* AssetManager::SharedZip::getResourceTableAsset()
Asset* AssetManager::SharedZip::getResourceTableAsset()
{
{
    AutoMutex _l(gLock);
    ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
    ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset);
    return mResourceTableAsset;
    return mResourceTableAsset;
}
}
@@ -1846,10 +1847,10 @@ Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset)
    {
    {
        AutoMutex _l(gLock);
        AutoMutex _l(gLock);
        if (mResourceTableAsset == NULL) {
        if (mResourceTableAsset == NULL) {
            mResourceTableAsset = asset;
            // This is not thread safe the first time it is called, so
            // This is not thread safe the first time it is called, so
            // do it here with the global lock held.
            // do it here with the global lock held.
            asset->getBuffer(true);
            asset->getBuffer(true);
            mResourceTableAsset = asset;
            return asset;
            return asset;
        }
        }
    }
    }