Fix possible crash in HistoryWidget.

Stack in crash reports leads to something like that:
- HistoryWidget::showHistory
- _scroll->setOwnedWidget
- Ui::ScrollArea::onScrolled
- sendSynteticMouseEvent
- Info::Media::ListWidget::enterEventHook
- Info::Media::ListWidget::mouseAction?Update
- Overview::Layout::ItemBase::clickHandlerActiveChanged
- AuthSessionData::requestItemRepaint
- HistoryWidget::repaintHistoryItem

Workaround:
- Don't accept repaint item requests while _list is not set yet.
This commit is contained in:
John Preston 2017-12-08 17:54:08 +04:00
parent 6295d85ef2
commit aef88559e8

View file

@ -4657,6 +4657,15 @@ void HistoryWidget::grabFinish() {
void HistoryWidget::repaintHistoryItem(
not_null<const HistoryItem*> item) {
// It is possible that repaintHistoryItem() will be called from
// _scroll->setOwnedWidget() because it calls onScroll() that
// sendSynteticMouseEvent() and it could lead to some Info layout
// calling Auth().data().requestItemRepaint(), while we still are
// in progrss of showing the history. Just ignore them for now :/
if (!_list) {
return;
}
auto itemHistory = item->history();
if (itemHistory == _history || itemHistory == _migrated) {
auto ms = getms();