diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 1924fb232d..88ba64c777 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -90,15 +90,20 @@ MediaView::MediaView(QWidget*) : TWidget(nullptr) connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onScreenResized(int))); // While we have one mediaview for all authsessions we have to do this. - subscribe(Messenger::Instance().authSessionChanged(), [this] { - if (!AuthSession::Exists()) return; - - subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] { - if (!isHidden()) { - updateControls(); - } - }); + auto subscribeToDownloadFinished = [this] { + if (AuthSession::Exists()) { + subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] { + if (!isHidden()) { + updateControls(); + } + }); + } + }; + subscribe(Messenger::Instance().authSessionChanged(), [this, subscribeToDownloadFinished] { + subscribeToDownloadFinished(); }); + subscribeToDownloadFinished(); + auto observeEvents = Notify::PeerUpdate::Flag::SharedMediaChanged; subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) { mediaOverviewUpdated(update);