Qt: Fix a race condition in the frame inspector
Vicki Pfau vi@endrift.com
Thu, 25 Jun 2020 01:19:06 -0700
2 files changed,
5 insertions(+),
6 deletions(-)
M
CHANGES
→
CHANGES
@@ -31,6 +31,7 @@ - GBA Savedata: Fix extracting save when not yet configured in-game
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642) - Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769) - Qt: Fix file handle leak on opening an invalid ROM + - Qt: Fix a race condition in the frame inspector Misc: - Debugger: Keep track of global cycle count - FFmpeg: Add looping option for GIF/APNG
M
src/platform/qt/FrameView.cpp
→
src/platform/qt/FrameView.cpp
@@ -386,12 +386,6 @@ m_currentFrame = m_nextFrame;
m_nextFrame = VFileMemChunk(nullptr, 0); if (m_currentFrame) { m_controller->endVideoLog(false); - VFile* currentFrame = VFileMemChunk(nullptr, m_currentFrame->size(m_currentFrame)); - void* buffer = currentFrame->map(currentFrame, m_currentFrame->size(m_currentFrame), MAP_WRITE); - m_currentFrame->seek(m_currentFrame, 0, SEEK_SET); - m_currentFrame->read(m_currentFrame, buffer, m_currentFrame->size(m_currentFrame)); - currentFrame->unmap(currentFrame, buffer, m_currentFrame->size(m_currentFrame)); - m_currentFrame = currentFrame; QMetaObject::invokeMethod(this, "newVl"); } m_controller->endVideoLog();@@ -403,12 +397,16 @@ if (!m_glowTimer.isActive()) {
m_glowTimer.start(); } QMutexLocker locker(&m_mutex); + if (!m_currentFrame) { + return; + } if (m_vl) { m_vl->deinit(m_vl); } m_vl = mCoreFindVF(m_currentFrame); m_vl->init(m_vl); m_vl->loadROM(m_vl, m_currentFrame); + m_currentFrame = nullptr; mCoreInitConfig(m_vl, nullptr); unsigned width, height; m_vl->desiredVideoDimensions(m_vl, &width, &height);