diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-10-03 20:26:41 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-10-03 20:26:41 +0000 |
commit | 224ffd3cb2b4f1cf031877d7ecba50562b3b9571 (patch) | |
tree | dcf1fc3b6265f6169c30a0291a6366cba8a1952e /libs/androidfw/AssetManager.cpp | |
parent | b2361007e9a502141b3f4d2887bd1a39c676b34c (diff) | |
parent | 73b91c63adcc185fb4e70b9c9025331891d927a9 (diff) |
Merge "[AssetManager]:Fix thread race caused double free issue." am: 126e022095 am: f48d0b8f19
am: 73b91c63ad
Change-Id: I27f5cc6106f0a8f0a58721e1e8ed836144347b6a
Diffstat (limited to 'libs/androidfw/AssetManager.cpp')
-rw-r--r-- | libs/androidfw/AssetManager.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index daf35921b13d..043989874bc8 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -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; } } |