mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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()) {
|
if (!raw->widget()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
QObject::connect(raw->widget(), &QObject::destroyed, [=] {
|
||||||
|
crl::on_main(this, [=] {
|
||||||
|
showCriticalError({ "Error: WebView has crashed." });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
container->geometryValue(
|
container->geometryValue(
|
||||||
) | rpl::start_with_next([=](QRect geometry) {
|
) | rpl::start_with_next([=](QRect geometry) {
|
||||||
raw->widget()->setGeometry(geometry);
|
if (raw->widget()) {
|
||||||
|
raw->widget()->setGeometry(geometry);
|
||||||
|
}
|
||||||
}, _webview->lifetime);
|
}, _webview->lifetime);
|
||||||
|
|
||||||
raw->setMessageHandler([=](const QJsonDocument &message) {
|
raw->setMessageHandler([=](const QJsonDocument &message) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/object_ptr.h"
|
#include "base/object_ptr.h"
|
||||||
|
#include "base/weak_ptr.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Show;
|
class Show;
|
||||||
|
@ -39,7 +40,7 @@ struct PaymentMethodDetails;
|
||||||
struct PaymentMethodAdditional;
|
struct PaymentMethodAdditional;
|
||||||
struct NativeMethodDetails;
|
struct NativeMethodDetails;
|
||||||
|
|
||||||
class Panel final {
|
class Panel final : public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
explicit Panel(not_null<PanelDelegate*> delegate);
|
explicit Panel(not_null<PanelDelegate*> delegate);
|
||||||
~Panel();
|
~Panel();
|
||||||
|
|
|
@ -603,10 +603,17 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) {
|
||||||
if (!raw->widget()) {
|
if (!raw->widget()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
QObject::connect(raw->widget(), &QObject::destroyed, [=] {
|
||||||
|
crl::on_main(this, [=] {
|
||||||
|
showCriticalError({ "Error: WebView has crashed." });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
container->geometryValue(
|
container->geometryValue(
|
||||||
) | rpl::start_with_next([=](QRect geometry) {
|
) | rpl::start_with_next([=](QRect geometry) {
|
||||||
raw->widget()->setGeometry(geometry);
|
if (raw->widget()) {
|
||||||
|
raw->widget()->setGeometry(geometry);
|
||||||
|
}
|
||||||
}, _webview->lifetime);
|
}, _webview->lifetime);
|
||||||
|
|
||||||
raw->setMessageHandler([=](const QJsonDocument &message) {
|
raw->setMessageHandler([=](const QJsonDocument &message) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 3495eb8dd8f4e2dab9493b4a698e5006fadbca47
|
Subproject commit c83478cd5ce2eb6fb343d9c96cec31688fe6d5f6
|
Loading…
Add table
Reference in a new issue