From 6295d85ef2546c4ebf454a3d2c79892d23faf50b Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 8 Dec 2017 17:36:17 +0400 Subject: [PATCH] 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). --- Telegram/SourceFiles/boxes/abstract_box.cpp | 2 +- Telegram/SourceFiles/boxes/peer_list_box.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/boxes/abstract_box.cpp b/Telegram/SourceFiles/boxes/abstract_box.cpp index 0c46ecedf..33b303266 100644 --- a/Telegram/SourceFiles/boxes/abstract_box.cpp +++ b/Telegram/SourceFiles/boxes/abstract_box.cpp @@ -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) { diff --git a/Telegram/SourceFiles/boxes/peer_list_box.h b/Telegram/SourceFiles/boxes/peer_list_box.h index 09fb6913d..3982d5d41 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.h +++ b/Telegram/SourceFiles/boxes/peer_list_box.h @@ -807,6 +807,6 @@ private: std::unique_ptr _controller; base::lambda _init; - bool _scrollBottomFixed = true; + bool _scrollBottomFixed = false; };