2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Don't hold session pointer in Data::CloudImage.

This commit is contained in:
John Preston
2020-05-28 17:51:18 +04:00
parent 29a498b959
commit 249f7813c1
11 changed files with 81 additions and 53 deletions

View File

@@ -250,14 +250,18 @@ void GifsListWidget::inlineResultsDone(const MTPmessages_BotResults &result) {
_inlineQuery,
std::make_unique<InlineCacheEntry>()).first;
}
auto entry = it->second.get();
const auto entry = it->second.get();
entry->nextOffset = qs(d.vnext_offset().value_or_empty());
if (auto count = v.size()) {
if (const auto count = v.size()) {
entry->results.reserve(entry->results.size() + count);
}
auto added = 0;
for_const (const auto &res, v) {
if (auto result = InlineBots::Result::create(queryId, res)) {
for (const auto &res : v) {
auto result = InlineBots::Result::Create(
&controller()->session(),
queryId,
res);
if (result) {
++added;
entry->results.push_back(std::move(result));
}