Permalink
Browse files

Qt: Fix loading game when game is loaded

  • Loading branch information...
endrift committed Jun 25, 2018
1 parent a19928f commit 0ae51f47d9240d065f7353f9c70cacefe5101c87
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/platform/qt/Window.cpp
View
@@ -737,6 +737,7 @@ void Window::gameStarted() {
}
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);

0 comments on commit 0ae51f4

Please sign in to comment.