From 95d8bb01ac3867bc6f19b59dc47d1b2cd729bf6e Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 12 Mar 2020 12:12:03 +0300 Subject: [PATCH] Guarded paletteChanged handling in touchbar's PinnedDialogButton. --- Telegram/SourceFiles/platform/mac/mac_touchbar.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/platform/mac/mac_touchbar.mm b/Telegram/SourceFiles/platform/mac/mac_touchbar.mm index 4758605c4..e4b5f70ce 100644 --- a/Telegram/SourceFiles/platform/mac/mac_touchbar.mm +++ b/Telegram/SourceFiles/platform/mac/mac_touchbar.mm @@ -481,6 +481,8 @@ void AppendEmojiPacks(std::vector &to) { @implementation PinnedDialogButton { rpl::lifetime _lifetime; rpl::lifetime _peerChangedLifetime; + base::has_weak_ptr _guard; + bool isWaitingUserpicLoad; } @@ -518,7 +520,7 @@ void AppendEmojiPacks(std::vector &to) { ) | rpl::filter([](const Window::Theme::BackgroundUpdate &update) { return update.paletteChanged(); }) | rpl::start_with_next([=] { - crl::on_main([=] { + crl::on_main(&_guard, [=] { if (_number <= kSavedMessagesId || UseEmptyUserpic(_peer)) { [self updateUserpic]; } else if (_peer