[vlc-commits] [Git][videolan/vlc][master] qt: fix threaded offscreen surface creation in rhi gl probing

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jul 18 00:52:31 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
f6392f74 by Fatih Uzunoglu at 2026-07-18T02:31:32+02:00
qt: fix threaded offscreen surface creation in rhi gl probing

Qt does not allow creating and making use of surfaces in non-
GUI thread.

This fixes crash when probing rhi gl backend.

Amends cb361557.

- - - - -


1 changed file:

- modules/gui/qt/qt.cpp


Changes:

=====================================
modules/gui/qt/qt.cpp
=====================================
@@ -993,16 +993,20 @@ static void *Thread( void *obj )
             }
         }
 
-        {
+        std::optional<QPair<QSGRendererInterface::GraphicsApi, bool>> retGlProbe;
+        QMetaObject::invokeMethod(qApp, [&retGlProbe]() {
+            // Due to offscreen surface involvement, this has to be done in the
+            // gui thread only:
             QRhiGles2InitParams params;
             params.fallbackSurface = QRhiGles2InitParams::newFallbackSurface();
             if (QRhi::probe(QRhi::OpenGLES2, &params))
             {
-                delete params.fallbackSurface;
-                return {QSGRendererInterface::OpenGL, false};
+                retGlProbe = {QSGRendererInterface::OpenGL, false};
             }
             delete params.fallbackSurface;
-        }
+        }, Qt::BlockingQueuedConnection);
+        if (retGlProbe)
+            return *retGlProbe;
 
         // TODO: Investigate if using Vulkan makes sense on Windows.
         // TODO: Investigate if it makes sense to try D3D12 when probing D3D11 failed.



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f6392f74b5859e678c094043ff7f2568bdb49350

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f6392f74b5859e678c094043ff7f2568bdb49350
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list