From d15ff46eb493d8788ee1208724cb0fb14d2a6080 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 8 Apr 2022 18:35:55 +0400 Subject: [PATCH] Fix webview initialization on GCC. --- .../SourceFiles/payments/ui/payments_panel.cpp | 14 +++++++------- .../ui/chat/attach/attach_bot_webview.cpp | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Telegram/SourceFiles/payments/ui/payments_panel.cpp b/Telegram/SourceFiles/payments/ui/payments_panel.cpp index c2a48d3d86..f81e39cd27 100644 --- a/Telegram/SourceFiles/payments/ui/payments_panel.cpp +++ b/Telegram/SourceFiles/payments/ui/payments_panel.cpp @@ -491,28 +491,30 @@ bool Panel::showWebview( } bool Panel::createWebview() { - auto container = base::make_unique_q(_widget.get()); + auto outer = base::make_unique_q(_widget.get()); + const auto container = outer.get(); + _widget->showInner(std::move(outer)); _webviewBottom = std::make_unique(_widget.get()); const auto bottom = _webviewBottom.get(); bottom->show(); bottom->heightValue( - ) | rpl::start_with_next([=, raw = container.get()](int height) { + ) | rpl::start_with_next([=](int height) { const auto inner = _widget->innerGeometry(); bottom->move(inner.x(), inner.y() + inner.height() - height); - raw->resize(inner.width(), inner.height() - height); + container->resize(inner.width(), inner.height() - height); bottom->resizeToWidth(inner.width()); }, bottom->lifetime()); container->show(); _webview = std::make_unique( - container.get(), + container, Webview::WindowConfig{ .userDataPath = _delegate->panelWebviewDataPath(), }); const auto raw = &_webview->window; - QObject::connect(container.get(), &QObject::destroyed, [=] { + QObject::connect(container, &QObject::destroyed, [=] { if (_webview && &_webview->window == raw) { _webview = nullptr; if (_webviewProgress) { @@ -563,8 +565,6 @@ postEvent: function(eventType, eventData) { } };)"); - _widget->showInner(std::move(container)); - setupProgressGeometry(); return true; diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index e47cb07efa..77153a7e55 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -496,32 +496,34 @@ bool Panel::showWebview( } bool Panel::createWebview() { - auto container = base::make_unique_q(_widget.get()); - _webviewParent = container.get(); + auto outer = base::make_unique_q(_widget.get()); + const auto container = outer.get(); + _widget->showInner(std::move(outer)); + _webviewParent = container; _webviewBottom = std::make_unique(_widget.get()); const auto bottom = _webviewBottom.get(); bottom->show(); bottom->heightValue( - ) | rpl::start_with_next([=, raw = container.get()](int height) { + ) | rpl::start_with_next([=](int height) { const auto inner = _widget->innerGeometry(); if (_mainButton && !_mainButton->isHidden()) { height = _mainButton->height(); } bottom->move(inner.x(), inner.y() + inner.height() - height); - raw->resize(inner.width(), inner.height() - height); + container->resize(inner.width(), inner.height() - height); bottom->resizeToWidth(inner.width()); }, bottom->lifetime()); container->show(); _webview = std::make_unique( - container.get(), + container, Webview::WindowConfig{ .userDataPath = _userDataPath, }); const auto raw = &_webview->window; - QObject::connect(container.get(), &QObject::destroyed, [=] { + QObject::connect(container, &QObject::destroyed, [=] { if (_webview && &_webview->window == raw) { _webview = nullptr; if (_webviewProgress) { @@ -584,8 +586,6 @@ postEvent: function(eventType, eventData) { } };)"); - _widget->showInner(std::move(container)); - setupProgressGeometry(); return true;