mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-11 09:19:35 +00:00
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_databases.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "payments/payments_checkout_process.h"
|
||||
#include "export/export_manager.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_controller.h"
|
||||
@ -149,6 +150,15 @@ Application::~Application() {
|
||||
_window = nullptr;
|
||||
_mediaView = nullptr;
|
||||
_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();
|
||||
|
||||
Local::finish();
|
||||
|
@ -112,6 +112,10 @@ bool CheckoutProcess::TakePaymentStarted(
|
||||
return true;
|
||||
}
|
||||
|
||||
void CheckoutProcess::ClearAll() {
|
||||
Processes.clear();
|
||||
}
|
||||
|
||||
void CheckoutProcess::RegisterPaymentStart(
|
||||
not_null<CheckoutProcess*> process) {
|
||||
const auto i = Processes.find(process->_session);
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
Fn<void()> reactivate);
|
||||
[[nodiscard]] static bool TakePaymentStarted(
|
||||
not_null<const HistoryItem*> item);
|
||||
static void ClearAll();
|
||||
|
||||
CheckoutProcess(
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -501,7 +501,7 @@ bool Panel::createWebview() {
|
||||
_webview = nullptr;
|
||||
if (_webviewProgress) {
|
||||
hideWebviewProgress();
|
||||
if (!_progress->shown) {
|
||||
if (_progress && !_progress->shown) {
|
||||
_progress = nullptr;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user