diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 0e66771b89..d7f68a63c9 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -873,10 +873,13 @@ void DeleteMessagesBox::deleteAndClear() { // deleteMessages can initiate closing of the current section, // which will cause this box to be destroyed. const auto session = _session; + const auto weak = Ui::MakeWeak(this); - _session->data().histories().deleteMessages(_ids, revoke); + session->data().histories().deleteMessages(_ids, revoke); - Ui::hideLayer(); + if (const auto strong = weak.data()) { + strong->closeBox(); + } session->data().sendHistoryChangeNotifications(); } diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp index 1f52f24381..68121430ab 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.cpp +++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp @@ -355,7 +355,9 @@ base::unique_qptr BoxController::rowContextMenu( auto result = base::make_unique_q(parent); result->addAction(tr::lng_context_delete_selected(tr::now), [=] { - Ui::show(Box(session, base::duplicate(ids))); + Ui::show( + Box(session, base::duplicate(ids)), + Ui::LayerOption::KeepOther); }); return result; }