Attempt to fix an assertion violation.

In some cases HistoryItem::attachToBlock was not calling
History::setHasPendingResizedItems (if it was not pending resize).

That could lead to addition of a whole block of items without
setting pending resize for the history and it violated the history
invariant of the _blocks y/height and their _items y/height.

Now each time we attachToBlock an item we also setPendingResize it.
This commit is contained in:
John Preston 2017-05-12 17:05:06 +03:00
parent d581e00299
commit 5fe75fbd5f
1 changed files with 4 additions and 10 deletions

View File

@ -529,9 +529,7 @@ public:
_block = block;
_indexInBlock = index;
if (pendingResize()) {
_history->setHasPendingResizedItems();
}
setPendingResize();
}
void setIndexInBlock(int index) {
Expects(_block != nullptr);
@ -540,13 +538,9 @@ public:
_indexInBlock = index;
}
int indexInBlock() const {
if (_indexInBlock >= 0) {
t_assert(_block != nullptr);
t_assert(_block->items.at(_indexInBlock) == this);
} else if (_block != nullptr) {
t_assert(_indexInBlock >= 0);
t_assert(_block->items.at(_indexInBlock) == this);
}
Expects((_indexInBlock >= 0) == (_block != nullptr));
Expects((_block == nullptr) || (_block->items[_indexInBlock] == this));
return _indexInBlock;
}
bool out() const {