Qt: Force OpenGL paint engine creation thread (fixes #1642)

This commit is contained in:
Vicki Pfau 2020-01-25 15:10:15 -08:00
parent cde4e1adee
commit 0450995074
2 changed files with 10 additions and 0 deletions

View File

@ -11,6 +11,7 @@ Emulation fixes:
Other fixes:
- Qt: Only dynamically reset video scale if a game is running
- Qt: Fix race condition with proxied video events
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
0.8.0: (2020-01-21)
Features:

View File

@ -271,6 +271,15 @@ PainterGL::PainterGL(QWindow* surface, QOpenGLContext* parent, int forceVersion)
m_gl->makeCurrent(m_surface);
m_window = new QOpenGLPaintDevice;
{
// XXX: Qt creates TLS for OpenGL objects in the local thread
// We need to prevent that thread from being the painter thread
// Qt also caches the engine object on the device if a different
// engine is active, so let's make a temporary one
QOpenGLPaintDevice* fakeDevice = new QOpenGLPaintDevice;
QPainter fakePainter(fakeDevice);
m_window->paintEngine();
}
#if defined(_WIN32) && defined(USE_EPOXY)
epoxy_handle_external_wglMakeCurrent();
#endif