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

View file

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