mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Handle webview crash
This commit is contained in:
parent
cb4fce251e
commit
d63ebbe62c
4 changed files with 19 additions and 4 deletions
|
@ -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 @@
|
|||
Subproject commit 3495eb8dd8f4e2dab9493b4a698e5006fadbca47
|
||||
Subproject commit c83478cd5ce2eb6fb343d9c96cec31688fe6d5f6
|
Loading…
Add table
Reference in a new issue