diff --git a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp index e987cc7703..e646309bb3 100644 --- a/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp +++ b/Telegram/SourceFiles/history/view/history_view_reaction_preview.cpp @@ -53,8 +53,16 @@ bool ShowReactionPreview( base::unique_qptr clickable; base::unique_qptr background; base::unique_qptr label; + + void clear() { + mediaPreview.reset(); + clickable.reset(); + background.reset(); + label.reset(); + }; + }; - const auto state = std::make_shared(); + const auto state = std::make_shared>(); const auto mainwidget = controller->widget(); state->mediaPreview = base::make_unique_q( @@ -73,9 +81,7 @@ bool ShowReactionPreview( } base::call_delayed( st::defaultToggle.duration, - crl::guard(state->clickable.get(), [=] { - state->clickable.reset(); - })); + [=] { state->clear(); }); }; state->clickable->setClickedCallback(hideAll); base::install_event_filter(QCoreApplication::instance(), [=]( @@ -150,8 +156,6 @@ bool ShowReactionPreview( mainwidget->sizeValue() | rpl::on_next([=](QSize size) { mediaPreviewRaw->setGeometry(Rect(size)); - clickableRaw->setGeometry(Rect(size)); - clickableRaw->raise(); if (backgroundRaw && labelRaw) { const auto maxLabelWidth = labelRaw->textMaxWidth() / 2; @@ -174,6 +178,11 @@ bool ShowReactionPreview( backgroundRaw->raise(); } }, mediaPreviewRaw->lifetime()); + + mainwidget->sizeValue() | rpl::on_next([=](QSize size) { + clickableRaw->setGeometry(Rect(size)); + clickableRaw->raise(); + }, clickableRaw->lifetime()); return true; }