Merge "make shutdown safe for double calls." am: 71fa1068de

am: 2f93c657f4

Change-Id: I78962b7272ef0c39a133db042f36684fc1324018
This commit is contained in:
Keun-young Park 2017-03-15 02:52:10 +00:00 committed by android-build-merger
commit 2a8605b9d1

View file

@ -633,8 +633,13 @@ int VolumeManager::reset() {
return 0; return 0;
} }
// Can be called twice (sequentially) during shutdown. should be safe for that.
int VolumeManager::shutdown() { int VolumeManager::shutdown() {
if (mInternalEmulated == nullptr) {
return 0; // already shutdown
}
mInternalEmulated->destroy(); mInternalEmulated->destroy();
mInternalEmulated = nullptr;
for (const auto& disk : mDisks) { for (const auto& disk : mDisks) {
disk->destroy(); disk->destroy();
} }