diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 49d982706d..ec79b54ad0 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -1389,9 +1389,10 @@ void Session::unloadHeavyViewParts( if (_heavyViewParts.empty()) { return; } - const auto remove = ranges::count(_heavyViewParts, delegate, [](not_null element) { - return element->delegate(); - }); + const auto remove = ranges::count( + _heavyViewParts, + delegate, + [](not_null element) { return element->delegate(); }); if (remove == _heavyViewParts.size()) { for (const auto view : base::take(_heavyViewParts)) { view->unloadHeavyPart(); @@ -3225,10 +3226,12 @@ void Session::unregisterContactItem( void Session::registerPlayingVideoFile(not_null view) { _playingVideoFiles.emplace(view); + registerHeavyViewPart(view); } void Session::unregisterPlayingVideoFile(not_null view) { _playingVideoFiles.remove(view); + unregisterHeavyViewPart(view); } void Session::stopPlayingVideoFiles() { diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 32801fe2dc..a91b189a01 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -369,10 +369,11 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms } if (radial - || (!streamed - && !startPlayAsync - && ((_streamed && _streamed->player().failed()) - || (!_data->loaded() && !_data->loading()) + || (!startPlayAsync + && (!_streamed + || _streamed->waitingShown() + || _streamed->player().failed()) + && ((!_data->loaded() && !_data->loading()) || !autoplayEnabled()))) { auto radialOpacity = (radial && _data->loaded() && item->id > 0) ? _animation->radial.opacity() diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.h b/Telegram/SourceFiles/history/view/media/history_view_gif.h index 7632c1f856..adf7e35f7a 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.h +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.h @@ -80,6 +80,10 @@ public: void parentTextUpdated() override; + void unloadHeavyPart() override { + stopAnimation(); + } + private: float64 dataProgress() const override; bool dataFinished() const override;