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

Commit 82251b19 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "SF: Avoid accessing an invalidated iterator"

parents c4f09efa aa548fdb
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -123,7 +123,11 @@ void LayerLifecycleManager::onHandlesDestroyed(const std::vector<uint32_t>& dest
            ALOGV("%s destroyed layer %s", __func__, layer->getDebugStringShort().c_str());
            std::iter_swap(it, mLayers.end() - 1);
            mDestroyedLayers.emplace_back(std::move(mLayers.back()));
            if (it == mLayers.end() - 1) {
                it = mLayers.erase(mLayers.end() - 1);
            } else {
                mLayers.erase(mLayers.end() - 1);
            }
        } else {
            it++;
        }