From d122762b1e4b3832b4e3278b741811bdf5c07542 Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu <fuzun54@outlook.com> Date: Tue, 8 Apr 2025 21:24:35 +0300 Subject: [PATCH 1/2] qt: use correct key when removing the invalidated sg graphics api cache --- modules/gui/qt/qt.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index 57d25ed5dc14..4d7af91deb2b 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -967,11 +967,12 @@ static void *Thread( void *obj ) }; static const char* const asyncRhiProbeCompletedProperty = "asyncRhiProbeCompleted"; + // NOTE: `QSettings` accepts `QAnyStringView` starting from Qt 6.4, use `QLatin1String(View)`: + static constexpr QLatin1String graphicsApiKey {"graphics-api"}; if (qEnvironmentVariableIsEmpty("QSG_RHI_BACKEND") && qEnvironmentVariableIsEmpty("QT_QUICK_BACKEND") && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0) || !uint(qEnvironmentVariableIntValue("QSG_RHI_PREFER_SOFTWARE_RENDERER")))) { - static const char* const graphicsApiKey = "graphics-api"; const QVariant graphicsApiValue = p_intf->mainSettings->value(graphicsApiKey); // settings value can be string (ini file), do not use `typeId()`: if (graphicsApiValue.isValid() && Q_LIKELY(graphicsApiValue.canConvert<int>())) @@ -1062,7 +1063,7 @@ static void *Thread( void *obj ) if (!app.property(asyncRhiProbeCompletedProperty).toBool()) { assert(settings); - settings->remove(asyncRhiProbeCompletedProperty); + settings->remove(graphicsApiKey); settings->sync(); } #endif -- GitLab From 8e5c6d770a0858d762109c44ad577030f2398a0f Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu <fuzun54@outlook.com> Date: Tue, 8 Apr 2025 21:36:17 +0300 Subject: [PATCH 2/2] qt: classify scene graph error critical and not warning Note that fatal messages cause Qt to abort the program. I think standard errors are best represented with critical messages. We never want Qt to abort the program itself, as in most cases we can gracefully handle the situation (as done here). --- modules/gui/qt/qt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index 4d7af91deb2b..77ff2b160531 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -1054,7 +1054,7 @@ static void *Thread( void *obj ) &QQuickWindow::sceneGraphError, &app, [&app, mainCtx, settings](QQuickWindow::SceneGraphError error, const QString &message) { - qWarning() << "Compositor: Scene Graph Error: " << error << ", Message: " << message; + qCritical() << "Compositor: Scene Graph Error: " << error << ", Message: " << message; assert(mainCtx); #ifdef _WIN32 // This is not really important, as with graceful exit the events in the queue should -- GitLab