diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 156646537..f2ac18536 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -1744,7 +1744,7 @@ void MainWidget::createPlayer() { _player->shownValue() ) | rpl::start_with_next( [this] { playerHeightUpdated(); }, - lifetime()); + _player->lifetime()); _player->entity()->setCloseCallback([this] { closeBothPlayers(); }); _playerVolume.create(this); _player->entity()->volumeWidgetCreated(_playerVolume); @@ -1768,6 +1768,10 @@ void MainWidget::createPlayer() { } void MainWidget::playerHeightUpdated() { + if (!_player) { + // Player could be already "destroyDelayed", but still handle events. + return; + } auto playerHeight = _player->contentHeight(); if (playerHeight != _playerHeight) { _contentScrollAddToY += playerHeight - _playerHeight; diff --git a/Telegram/SourceFiles/ui/wrap/slide_wrap.cpp b/Telegram/SourceFiles/ui/wrap/slide_wrap.cpp index d1725400b..6fd455bff 100644 --- a/Telegram/SourceFiles/ui/wrap/slide_wrap.cpp +++ b/Telegram/SourceFiles/ui/wrap/slide_wrap.cpp @@ -120,8 +120,9 @@ void SlideWrap::animationStep() { } auto shouldBeHidden = !_toggled && !_animation.animating(); if (shouldBeHidden != isHidden()) { + const auto guard = make_weak(this); setVisible(!shouldBeHidden); - if (shouldBeHidden) { + if (shouldBeHidden && guard) { SendPendingMoveResizeEvents(this); } }