2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Let [Photo|Document]Media outlive message view.

This commit is contained in:
John Preston
2020-05-26 18:32:38 +04:00
parent 700d3db4cc
commit dbb46ce9b0
15 changed files with 48 additions and 27 deletions

View File

@@ -230,13 +230,9 @@ void PhotoData::collectLocalData(not_null<PhotoData*> local) {
}
}
if (const auto localMedia = local->activeMediaView()) {
const auto media = createMediaView();
auto media = createMediaView();
media->collectLocalData(localMedia.get());
// Keep DocumentMedia alive for some more time.
// NB! This allows DocumentMedia to outlive Main::Session!
// In case this is a problem this code should be rewritten.
crl::on_main(&session(), [media] {});
_owner->keepAlive(std::move(media));
}
}