diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index f8729948aa..3e490dc437 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -629,12 +629,17 @@ void PeerMenuShareContactBox(not_null user) { void PeerMenuCreatePoll(not_null peer) { const auto box = Ui::show(Box()); + const auto lock = box->lifetime().make_state(false); box->submitRequests( ) | rpl::start_with_next([=](const PollData &result) { + if (std::exchange(*lock, true)) { + return; + } const auto options = ApiWrap::SendOptions(App::history(peer)); Auth().api().createPoll(result, options, crl::guard(box, [=] { box->closeBox(); }), crl::guard(box, [=](const RPCError &error) { + *lock = false; box->submitFailed(lang(lng_attach_failed)); })); }, box->lifetime());