all repos — mgba @ 0ae51f47d9240d065f7353f9c70cacefe5101c87

mGBA Game Boy Advance Emulator

Qt: Fix loading game when game is loaded
Vicki Pfau vi@endrift.com
Mon, 25 Jun 2018 10:24:10 -0700
commit

0ae51f47d9240d065f7353f9c70cacefe5101c87

parent

a19928f030e6881be7c7a63898c1aeff946860c2

1 files changed, 9 insertions(+), 6 deletions(-)

jump to
M src/platform/qt/Window.cppsrc/platform/qt/Window.cpp

@@ -737,6 +737,7 @@ }

} void Window::gameStopped() { + m_controller.reset(); #ifdef M_CORE_GBA for (QAction* action : m_gbaActions) { action->setDisabled(false);

@@ -1807,15 +1808,17 @@ void Window::setController(CoreController* controller, const QString& fname) {

if (!controller) { return; } - if (!fname.isEmpty()) { - setWindowFilePath(fname); - appendMRU(fname); - } if (m_controller) { - m_controller->disconnect(this); m_controller->stop(); - m_controller.reset(); + QTimer::singleShot(0, this, [this, controller, fname]() { + setController(controller, fname); + }); + return; + } + if (!fname.isEmpty()) { + setWindowFilePath(fname); + appendMRU(fname); } m_controller = std::shared_ptr<CoreController>(controller);