Просмотр исходного кода

emu_thread: properly force shutdown for unresponsive guest programs

Liam 3 лет назад
Родитель
Сommit
179adee396
2 измененных файлов с 5 добавлено и 12 удалено
  1. 1 10
      src/yuzu/bootmanager.h
  2. 4 2
      src/yuzu/main.cpp

+ 1 - 10
src/yuzu/bootmanager.h

@@ -11,7 +11,6 @@
 #include <QImage>
 #include <QStringList>
 #include <QThread>
-#include <QTimer>
 #include <QTouchEvent>
 #include <QWidget>
 
@@ -85,17 +84,9 @@ public:
     }
 
     /**
-     * Requests for the emulation thread to stop running
+     * Requests for the emulation thread to immediately stop running
      */
-    void RequestStop() {
-        QTimer::singleShot(5000, this, &EmuThread::ForceStop);
-    }
-
-private slots:
     void ForceStop() {
-        if (!IsRunning()) {
-            return;
-        }
         LOG_WARNING(Frontend, "Force stopping EmuThread");
         stop_source.request_stop();
         SetRunning(false);

+ 4 - 2
src/yuzu/main.cpp

@@ -1792,12 +1792,14 @@ void GMainWindow::ShutdownGame() {
     discord_rpc->Pause();
 
     RequestGameExit();
-    emu_thread->RequestStop();
 
     emit EmulationStopping();
 
     // Wait for emulation thread to complete and delete it
-    emu_thread->wait();
+    if (!emu_thread->wait(5000)) {
+        emu_thread->ForceStop();
+        emu_thread->wait();
+    }
     emu_thread = nullptr;
 
     emulation_running = false;