Qt: Fix crash when switching from high-resolution OpenGL renderer to software

This commit is contained in:
Vicki Pfau 2021-04-08 18:41:53 -07:00
parent af212925e7
commit afd970423e
3 changed files with 7 additions and 4 deletions

View File

@ -11,6 +11,7 @@ Other fixes:
- GBA e-Reader: Fix bitmap short strip scanning
- GBA Video: Fix mode 5 frame 1 caching (fixes mgba.io/i/2075)
- GBA Video: Don't attempt to copy invalid registers when switching renderer
- Qt: Fix crash when switching from high-resolution OpenGL renderer to software
Misc:
- Core: Truncate preloading ROMs that slightly exceed max size (fixes mgba.io/i/2093)
- GBA: Default-enable VBA bug compat for Ruby and Emerald ROM hacks

View File

@ -368,6 +368,10 @@ void PainterGL::resizeContext() {
m_interrupter.resume();
QSize size = m_context->screenDimensions();
if (m_dims == size) {
return;
}
dequeueAll();
m_backend->setDimensions(m_backend, size.width(), size.height());
}
@ -560,9 +564,6 @@ void PainterGL::dequeueAll() {
m_free.append(buffer);
}
}
if (buffer) {
m_backend->postFrame(m_backend, buffer);
}
if (m_buffer) {
m_free.append(m_buffer);
m_buffer = nullptr;

View File

@ -142,7 +142,7 @@ private:
QList<uint32_t*> m_free;
QQueue<uint32_t*> m_queue;
QAtomicInt m_lagging = 0;
uint32_t* m_buffer;
uint32_t* m_buffer = nullptr;
QPainter m_painter;
QMutex m_mutex;
QWindow* m_surface;
@ -158,6 +158,7 @@ private:
VideoShader m_shader{};
VideoBackend* m_backend = nullptr;
QSize m_size;
QSize m_dims;
MessagePainter* m_messagePainter = nullptr;
QElapsedTimer m_delayTimer;
std::shared_ptr<VideoProxy> m_videoProxy;