diff --git a/Telegram/SourceFiles/payments/ui/payments_panel.cpp b/Telegram/SourceFiles/payments/ui/payments_panel.cpp index ec436f9e35..5e5c872de2 100644 --- a/Telegram/SourceFiles/payments/ui/payments_panel.cpp +++ b/Telegram/SourceFiles/payments/ui/payments_panel.cpp @@ -567,10 +567,17 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) { if (!raw->widget()) { return false; } + QObject::connect(raw->widget(), &QObject::destroyed, [=] { + crl::on_main(this, [=] { + showCriticalError({ "Error: WebView has crashed." }); + }); + }); container->geometryValue( ) | rpl::start_with_next([=](QRect geometry) { - raw->widget()->setGeometry(geometry); + if (raw->widget()) { + raw->widget()->setGeometry(geometry); + } }, _webview->lifetime); raw->setMessageHandler([=](const QJsonDocument &message) { diff --git a/Telegram/SourceFiles/payments/ui/payments_panel.h b/Telegram/SourceFiles/payments/ui/payments_panel.h index 6136dace48..b65def0156 100644 --- a/Telegram/SourceFiles/payments/ui/payments_panel.h +++ b/Telegram/SourceFiles/payments/ui/payments_panel.h @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #pragma once #include "base/object_ptr.h" +#include "base/weak_ptr.h" namespace Ui { class Show; @@ -39,7 +40,7 @@ struct PaymentMethodDetails; struct PaymentMethodAdditional; struct NativeMethodDetails; -class Panel final { +class Panel final : public base::has_weak_ptr { public: explicit Panel(not_null delegate); ~Panel(); diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index aa18ca2071..24a1a6e273 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -603,10 +603,17 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) { if (!raw->widget()) { return false; } + QObject::connect(raw->widget(), &QObject::destroyed, [=] { + crl::on_main(this, [=] { + showCriticalError({ "Error: WebView has crashed." }); + }); + }); container->geometryValue( ) | rpl::start_with_next([=](QRect geometry) { - raw->widget()->setGeometry(geometry); + if (raw->widget()) { + raw->widget()->setGeometry(geometry); + } }, _webview->lifetime); raw->setMessageHandler([=](const QJsonDocument &message) { diff --git a/Telegram/lib_webview b/Telegram/lib_webview index 3495eb8dd8..c83478cd5c 160000 --- a/Telegram/lib_webview +++ b/Telegram/lib_webview @@ -1 +1 @@ -Subproject commit 3495eb8dd8f4e2dab9493b4a698e5006fadbca47 +Subproject commit c83478cd5ce2eb6fb343d9c96cec31688fe6d5f6