Fix contract violation in shutdown with webview.
This commit is contained in:
parent
e52f947f98
commit
34c5ce16d0
|
@ -63,6 +63,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/storage_domain.h"
|
#include "storage/storage_domain.h"
|
||||||
#include "storage/storage_databases.h"
|
#include "storage/storage_databases.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
|
#include "payments/payments_checkout_process.h"
|
||||||
#include "export/export_manager.h"
|
#include "export/export_manager.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "window/window_controller.h"
|
#include "window/window_controller.h"
|
||||||
|
@ -149,6 +150,15 @@ Application::~Application() {
|
||||||
_window = nullptr;
|
_window = nullptr;
|
||||||
_mediaView = nullptr;
|
_mediaView = nullptr;
|
||||||
_notifications->clearAllFast();
|
_notifications->clearAllFast();
|
||||||
|
|
||||||
|
// We must manually destroy all windows before going further.
|
||||||
|
// DestroyWindow on Windows (at least with an active WebView) enters
|
||||||
|
// event loop and invoke scheduled crl::on_main callbacks.
|
||||||
|
//
|
||||||
|
// For example Domain::removeRedundantAccounts() is called from
|
||||||
|
// Domain::finish() and there is a violation on Ensures(started()).
|
||||||
|
Payments::CheckoutProcess::ClearAll();
|
||||||
|
|
||||||
_domain->finish();
|
_domain->finish();
|
||||||
|
|
||||||
Local::finish();
|
Local::finish();
|
||||||
|
|
|
@ -112,6 +112,10 @@ bool CheckoutProcess::TakePaymentStarted(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckoutProcess::ClearAll() {
|
||||||
|
Processes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void CheckoutProcess::RegisterPaymentStart(
|
void CheckoutProcess::RegisterPaymentStart(
|
||||||
not_null<CheckoutProcess*> process) {
|
not_null<CheckoutProcess*> process) {
|
||||||
const auto i = Processes.find(process->_session);
|
const auto i = Processes.find(process->_session);
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
Fn<void()> reactivate);
|
Fn<void()> reactivate);
|
||||||
[[nodiscard]] static bool TakePaymentStarted(
|
[[nodiscard]] static bool TakePaymentStarted(
|
||||||
not_null<const HistoryItem*> item);
|
not_null<const HistoryItem*> item);
|
||||||
|
static void ClearAll();
|
||||||
|
|
||||||
CheckoutProcess(
|
CheckoutProcess(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
|
|
|
@ -501,7 +501,7 @@ bool Panel::createWebview() {
|
||||||
_webview = nullptr;
|
_webview = nullptr;
|
||||||
if (_webviewProgress) {
|
if (_webviewProgress) {
|
||||||
hideWebviewProgress();
|
hideWebviewProgress();
|
||||||
if (!_progress->shown) {
|
if (_progress && !_progress->shown) {
|
||||||
_progress = nullptr;
|
_progress = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue