From ad3a0476e98e736c2eaacd1f37337d88b52c8733 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 10 May 2024 03:05:02 -0500 Subject: [PATCH] wip --- system/clearpilot/tools/qt_webview.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/clearpilot/tools/qt_webview.cc b/system/clearpilot/tools/qt_webview.cc index 046a19a..382c46e 100644 --- a/system/clearpilot/tools/qt_webview.cc +++ b/system/clearpilot/tools/qt_webview.cc @@ -38,12 +38,16 @@ public: QVBoxLayout *mainLayout = new QVBoxLayout(this); this->setLayout(mainLayout); - this->show(); - QTimer::singleShot(2000, [&]() { - WebViewFrame *webViewFrame = new WebViewFrame(this); + WebViewFrame *webViewFrame = nullptr; // Declare pointer but do not initialize + + QTimer::singleShot(2000, this, [=, &webViewFrame]() mutable { + webViewFrame = new WebViewFrame(this); // Initialize here mainLayout->addWidget(webViewFrame); }); + + this->show(); + } };