From a0eb07372833bcc22dd3fca27a4d565a36f22817 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 14 Aug 2020 19:59:24 +0400 Subject: [PATCH] Close call panel instead of hiding. --- Telegram/SourceFiles/calls/calls_instance.cpp | 19 +++++++++---------- Telegram/SourceFiles/calls/calls_instance.h | 1 - Telegram/SourceFiles/calls/calls_panel.cpp | 4 ++-- Telegram/SourceFiles/calls/calls_panel.h | 2 +- Telegram/lib_ui | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 325a66372..90c938b0c 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -55,11 +55,15 @@ void Instance::startOutgoingCall(not_null user, bool video) { } void Instance::callFinished(not_null call) { - destroyCall(call); + crl::on_main(call, [=] { + destroyCall(call); + }); } void Instance::callFailed(not_null call) { - destroyCall(call); + crl::on_main(call, [=] { + destroyCall(call); + }); } void Instance::callRedial(not_null call) { @@ -101,7 +105,9 @@ void Instance::playSound(Sound sound) { void Instance::destroyCall(not_null call) { if (_currentCall.get() == call) { - destroyCurrentPanel(); + _currentCallPanel->closeBeforeDestroy(); + _currentCallPanel = nullptr; + auto taken = base::take(_currentCall); _currentCallChanges.fire(nullptr); taken.reset(); @@ -113,13 +119,6 @@ void Instance::destroyCall(not_null call) { } } -void Instance::destroyCurrentPanel() { - _currentCallPanel->hideBeforeDestroy(); - - // Always queue the destruction. - crl::on_main([panel = std::move(_currentCallPanel)]{}); -} - void Instance::createCall(not_null user, Call::Type type, bool video) { auto call = std::make_unique(getCallDelegate(), user, type, video); const auto raw = call.get(); diff --git a/Telegram/SourceFiles/calls/calls_instance.h b/Telegram/SourceFiles/calls/calls_instance.h index 9ea58bec0..c983e1476 100644 --- a/Telegram/SourceFiles/calls/calls_instance.h +++ b/Telegram/SourceFiles/calls/calls_instance.h @@ -60,7 +60,6 @@ private: void playSound(Sound sound) override; void createCall(not_null user, Call::Type type, bool video); void destroyCall(not_null call); - void destroyCurrentPanel(); void requestPermissionsOrFail(Fn onSuccess) override; void requestPermissionOrFail(Platform::PermissionType type, Fn onSuccess); diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index 0a05a0dda..3559539ba 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -691,8 +691,8 @@ void Panel::showControls() { } } -void Panel::hideBeforeDestroy() { - _window->hide(); +void Panel::closeBeforeDestroy() { + _window->close(); reinitWithCall(nullptr); } diff --git a/Telegram/SourceFiles/calls/calls_panel.h b/Telegram/SourceFiles/calls/calls_panel.h index c27bc6c13..4b2ead0b0 100644 --- a/Telegram/SourceFiles/calls/calls_panel.h +++ b/Telegram/SourceFiles/calls/calls_panel.h @@ -52,7 +52,7 @@ public: void showAndActivate(); void replaceCall(not_null call); - void hideBeforeDestroy(); + void closeBeforeDestroy(); private: class Content; diff --git a/Telegram/lib_ui b/Telegram/lib_ui index f2f592be8..a1dbca857 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit f2f592be817edc289eaff0248f3e41c945b736bd +Subproject commit a1dbca85783289d737ce0368f5ec3659b5745458