mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Handle webview crash
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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<PanelDelegate*> delegate);
|
||||
~Panel();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
Submodule Telegram/lib_webview updated: 3495eb8dd8...c83478cd5c
Reference in New Issue
Block a user