Qt: Fix some Qt display driver race conditions
Vicki Pfau vi@endrift.com
Wed, 08 May 2019 13:50:30 -0700
3 files changed,
6 insertions(+),
1 deletions(-)
M
CHANGES
→
CHANGES
@@ -37,6 +37,7 @@ - LR35902: Fix trailing whitespace in disassembly
- Qt: Fix adjusting magnification in tile viewer when not fitting to window - FFmpeg: Improve initialization reliability and cleanup - Wii: Fix aspect ratio (fixes mgba.io/i/500) + - Qt: Fix some Qt display driver race conditions Misc: - GBA Savedata: EEPROM performance fixes - GBA Savedata: Automatically map 1Mbit Flash files as 1Mbit Flash
M
src/platform/qt/DisplayGL.cpp
→
src/platform/qt/DisplayGL.cpp
@@ -37,6 +37,7 @@ m_gl = new EmptyGLWidget(format, this);
m_painter = new PainterGL(format.majorVersion() < 2 ? 1 : m_gl->format().majorVersion(), m_gl); m_gl->setMouseTracking(true); m_gl->setAttribute(Qt::WA_TransparentForMouseEvents); // This doesn't seem to work? + setUpdatesEnabled(false); // Prevent paint events, which can cause race conditions } DisplayGL::~DisplayGL() {@@ -219,6 +220,9 @@ }
#endif m_backend->swap = [](VideoBackend* v) { PainterGL* painter = static_cast<PainterGL*>(v->user); + if (!painter->m_gl->isVisible()) { + return; + } painter->m_gl->swapBuffers(); };
M
src/platform/qt/DisplayGL.h
→
src/platform/qt/DisplayGL.h
@@ -32,7 +32,7 @@ public:
EmptyGLWidget(const QGLFormat& format, QWidget* parent) : QGLWidget(format, parent) { setAutoBufferSwap(false); } protected: - void paintEvent(QPaintEvent*) override {} + void paintEvent(QPaintEvent* event) override { event->ignore(); } void resizeEvent(QResizeEvent*) override {} void mouseMoveEvent(QMouseEvent* event) override { event->ignore(); } };