Qt: Fix sending gameStopped twice

This commit is contained in:
Jeffrey Pfau 2016-02-09 02:00:45 -08:00
parent 564f58c7fb
commit 1fdf413ee9
2 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,7 @@
0.5.0: (Future) 0.5.0: (Future)
Bugfixes: Bugfixes:
- VFS: Fix reading 7z archives without rewinding first - VFS: Fix reading 7z archives without rewinding first
- Qt: Fix sending gameStopped twice
Misc: Misc:
- GBA: Slightly optimize GBAProcessEvents - GBA: Slightly optimize GBAProcessEvents

View File

@ -11,6 +11,7 @@
#include "MultiplayerController.h" #include "MultiplayerController.h"
#include "VFileDevice.h" #include "VFileDevice.h"
#include <QCoreApplication>
#include <QDateTime> #include <QDateTime>
#include <QThread> #include <QThread>
@ -419,6 +420,8 @@ void GameController::closeGame() {
if (!m_gameOpen) { if (!m_gameOpen) {
return; return;
} }
m_gameOpen = false;
m_rewindTimer.stop(); m_rewindTimer.stop();
if (GBAThreadIsPaused(&m_threadContext)) { if (GBAThreadIsPaused(&m_threadContext)) {
GBAThreadUnpause(&m_threadContext); GBAThreadUnpause(&m_threadContext);
@ -426,6 +429,8 @@ void GameController::closeGame() {
m_audioProcessor->pause(); m_audioProcessor->pause();
GBAThreadEnd(&m_threadContext); GBAThreadEnd(&m_threadContext);
GBAThreadJoin(&m_threadContext); GBAThreadJoin(&m_threadContext);
// Make sure the event queue clears out before the thread is reused
QCoreApplication::processEvents();
if (m_threadContext.fname) { if (m_threadContext.fname) {
free(const_cast<char*>(m_threadContext.fname)); free(const_cast<char*>(m_threadContext.fname));
m_threadContext.fname = nullptr; m_threadContext.fname = nullptr;