зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730534 - Part 1: Assert state of SegmentedVector iterator is valid r=mccr8
The next patches remove elements from a segmented vector that is being iterated. This patch adds assertions to ensure that we don't attempt to use an iterator that points to a removed element. The assertions are added to Done() because all the other methods call that. Differential Revision: https://phabricator.services.mozilla.com/D125426
This commit is contained in:
Родитель
c11679da97
Коммит
4055d681e6
|
@ -289,7 +289,11 @@ class SegmentedVector : private AllocPolicy {
|
|||
}
|
||||
|
||||
public:
|
||||
bool Done() const { return !mSegment; }
|
||||
bool Done() const {
|
||||
MOZ_ASSERT_IF(mSegment, mSegment->isInList());
|
||||
MOZ_ASSERT_IF(mSegment, mIndex < mSegment->Length());
|
||||
return !mSegment;
|
||||
}
|
||||
|
||||
T& Get() {
|
||||
MOZ_ASSERT(!Done());
|
||||
|
|
Загрузка…
Ссылка в новой задаче