From 0bee95570e7d28afa5cee91b3d1c642051ba1da8 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Thu, 9 Nov 2023 01:55:31 +0400 Subject: [PATCH] Prevent false positives in TWidgetPrivate::rhiConfig QWidget::create could set the WA_WState_Created flag without creating actual window. Adding the check from the top of QWidgetPrivate::create should prevent such false positives. --- ui/rp_widget.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/rp_widget.cpp b/ui/rp_widget.cpp index 42d8e95..4fc7c3b 100644 --- a/ui/rp_widget.cpp +++ b/ui/rp_widget.cpp @@ -23,7 +23,9 @@ public: #if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) QPlatformBackingStoreRhiConfig rhiConfig() const override { const auto q = static_cast(q_ptr); - if (!q->testAttribute(Qt::WA_WState_Created)) { + if (!q->testAttribute(Qt::WA_WState_Created) + || (!q->testAttribute(Qt::WA_NativeWindow) + && !q->isWindow())) { return QWidgetPrivate::rhiConfig(); } if (const auto config = q->rhiConfig()) {