diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 8b8191d66b..29df961b06 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -258,6 +258,15 @@ void QSGRenderLoop::setInstance(QSGRenderLoop *instance) void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window) { + // Must always be called on the gui thread. + + // Guard for recursion; relevant due to the MessageBox() on Windows. + static QSet recurseGuard; + if (recurseGuard.contains(window)) + return; + + recurseGuard.insert(window); + QString translatedMessage; QString untranslatedMessage; QQuickWindowPrivate::rhiCreationFailureMessage(QSGRhiSupport::instance()->rhiBackendName(), @@ -278,6 +287,8 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window) #endif // Q_OS_WIN if (!signalEmitted) qFatal("%s", qPrintable(untranslatedMessage)); + + recurseGuard.remove(window); } #ifdef ENABLE_DEFAULT_BACKEND