Fix possible assertion violation in PeerListBox.

Very long stack in crash reports leads to something like that:
- PeerListBox::prepare
- PeerListBox::createMultiSelect
- PeerListBox::updateScrollSkips
- BoxContent::setInnerTopSkip
- _scroll->scrollToY
- sendSynteticMouseEvent
- ChatHelpers::TabbedPanel::showAnimated
- QWidget::render
- QWidgetPrivate::sendPendingMoveAndResizeEvents
- PeerListBox::resizeEvent
- _select->resizeToWidth(0)
- MultiSelect::Inner::computeItemsGeometry(0)

Workaround:
- Don't scrollToY if PeerListBox width was not yet set.
- Initial _scrollBottomFixed is false (at first createMultiSelect).
This commit is contained in:
John Preston 2017-12-08 17:36:17 +04:00
parent a27ea2d631
commit 6295d85ef2
2 changed files with 2 additions and 2 deletions

View file

@ -148,7 +148,7 @@ void BoxContent::setInnerTopSkip(int innerTopSkip, bool scrollBottomFixed) {
if (_innerTopSkip != innerTopSkip) {
auto delta = innerTopSkip - _innerTopSkip;
_innerTopSkip = innerTopSkip;
if (_scroll) {
if (_scroll && width() > 0) {
auto scrollTopWas = _scroll->scrollTop();
updateScrollAreaGeometry();
if (scrollBottomFixed) {

View file

@ -807,6 +807,6 @@ private:
std::unique_ptr<PeerListController> _controller;
base::lambda<void(PeerListBox*)> _init;
bool _scrollBottomFixed = true;
bool _scrollBottomFixed = false;
};