mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Fix wrong "Webview process crashed." message.
This commit is contained in:
parent
3b50bc71b3
commit
16a2d4ec96
3 changed files with 26 additions and 5 deletions
|
@ -96,7 +96,7 @@ Panel::Panel(not_null<PanelDelegate*> delegate)
|
|||
}
|
||||
|
||||
Panel::~Panel() {
|
||||
_webview = nullptr;
|
||||
base::take(_webview);
|
||||
_progress = nullptr;
|
||||
_widget = nullptr;
|
||||
}
|
||||
|
@ -528,6 +528,7 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) {
|
|||
auto outer = base::make_unique_q<RpWidget>(_widget.get());
|
||||
const auto container = outer.get();
|
||||
_widget->showInner(std::move(outer));
|
||||
const auto webviewParent = QPointer<RpWidget>(container);
|
||||
|
||||
_webviewBottom = std::make_unique<RpWidget>(_widget.get());
|
||||
const auto bottom = _webviewBottom.get();
|
||||
|
@ -552,7 +553,7 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) {
|
|||
const auto raw = &_webview->window;
|
||||
QObject::connect(container, &QObject::destroyed, [=] {
|
||||
if (_webview && &_webview->window == raw) {
|
||||
_webview = nullptr;
|
||||
base::take(_webview);
|
||||
if (_webviewProgress) {
|
||||
hideWebviewProgress();
|
||||
if (_progress && !_progress->shown) {
|
||||
|
@ -568,6 +569,16 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) {
|
|||
return false;
|
||||
}
|
||||
QObject::connect(raw->widget(), &QObject::destroyed, [=] {
|
||||
const auto parent = webviewParent.data();
|
||||
if (!_webview
|
||||
|| &_webview->window != raw
|
||||
|| !parent
|
||||
|| _widget->inner() != parent) {
|
||||
// If we destroyed _webview ourselves,
|
||||
// or if we changed _widget->inner ourselves,
|
||||
// we don't show any message, nothing crashed.
|
||||
return;
|
||||
}
|
||||
crl::on_main(this, [=] {
|
||||
showCriticalError({ "Error: WebView has crashed." });
|
||||
});
|
||||
|
|
|
@ -364,7 +364,7 @@ Panel::Panel(
|
|||
}
|
||||
|
||||
Panel::~Panel() {
|
||||
_webview = nullptr;
|
||||
base::take(_webview);
|
||||
_progress = nullptr;
|
||||
_widget = nullptr;
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) {
|
|||
|
||||
QObject::connect(container, &QObject::destroyed, [=] {
|
||||
if (_webview && &_webview->window == raw) {
|
||||
_webview = nullptr;
|
||||
base::take(_webview);
|
||||
if (_webviewProgress) {
|
||||
hideWebviewProgress();
|
||||
if (_progress && !_progress->shown) {
|
||||
|
@ -604,6 +604,16 @@ bool Panel::createWebview(const Webview::ThemeParams ¶ms) {
|
|||
return false;
|
||||
}
|
||||
QObject::connect(raw->widget(), &QObject::destroyed, [=] {
|
||||
const auto parent = _webviewParent.data();
|
||||
if (!_webview
|
||||
|| &_webview->window != raw
|
||||
|| !parent
|
||||
|| _widget->inner() != parent) {
|
||||
// If we destroyed _webview ourselves,
|
||||
// or if we changed _widget->inner ourselves,
|
||||
// we don't show any message, nothing crashed.
|
||||
return;
|
||||
}
|
||||
crl::on_main(this, [=] {
|
||||
showCriticalError({ "Error: WebView has crashed." });
|
||||
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7fef09421c2b71e5ab9cf481c0fcf2a0b6d2daf0
|
||||
Subproject commit 30c5dfe6f65babf234c889959061c97c4a2f391d
|
Loading…
Add table
Reference in a new issue