Fix possible crash in media viewer content re-show.

This commit is contained in:
John Preston 2023-03-17 17:51:35 +04:00
parent 68eb99bde0
commit f410a3b6da
2 changed files with 5 additions and 2 deletions

View File

@ -2072,14 +2072,16 @@ void OverlayWidget::handleDocumentClick() {
if (_document->loading()) {
saveCancel();
} else {
_reShow = true;
Data::ResolveDocument(
findWindow(),
_document,
_message,
_topicRootId);
if (_document->loading() && !_radial.animating()) {
if (_document && _document->loading() && !_radial.animating()) {
_radial.start(_documentMedia->progress());
}
_reShow = false;
}
}
@ -2852,7 +2854,7 @@ void OverlayWidget::show(OpenRequest request) {
const auto contextItem = request.item();
const auto contextPeer = request.peer();
const auto contextTopicRootId = request.topicRootId();
if (!request.continueStreaming() && !request.startTime()) {
if (!request.continueStreaming() && !request.startTime() && !_reShow) {
if (_message && (_message == contextItem)) {
return close();
} else if (_user && (_user == contextPeer)) {

View File

@ -539,6 +539,7 @@ private:
QImage _staticContent;
bool _staticContentTransparent = false;
bool _blurred = true;
bool _reShow = false;
ContentGeometry _oldGeometry;
Ui::Animations::Simple _geometryAnimation;