mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
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:
parent
c11679da97
commit
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());
|
||||
|
Loading…
Reference in New Issue
Block a user