mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Fixed leak of premium preview preloads after show expiry.
This commit is contained in:
@@ -1326,6 +1326,15 @@ void Show(
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveExpiredPreloads() {
|
||||
auto &list = Preloads();
|
||||
list.erase(
|
||||
ranges::remove_if(list, [](const Preload &preload) {
|
||||
return preload.show.expired();
|
||||
}),
|
||||
end(list));
|
||||
}
|
||||
|
||||
void Show(std::shared_ptr<ChatHelpers::Show> show, QImage back) {
|
||||
auto &list = Preloads();
|
||||
for (auto i = begin(list); i != end(list);) {
|
||||
@@ -1479,6 +1488,8 @@ void Show(
|
||||
crl::on_main([=] {
|
||||
if (auto strong = weak.lock()) {
|
||||
Show(std::move(strong), result);
|
||||
} else {
|
||||
RemoveExpiredPreloads();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user