mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 14:15:41 +12:00
Qt: Stop emuThread on closeEvent
This commit is contained in:
parent
df5d14e3d8
commit
19b69bbdc2
2 changed files with 8 additions and 2 deletions
|
@ -139,6 +139,7 @@ class MainWindow : public QMainWindow {
|
|||
MainWindow(QApplication* app, QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
|
|
|
@ -204,14 +204,19 @@ void MainWindow::selectLuaFile() {
|
|||
}
|
||||
}
|
||||
|
||||
// Cleanup when the main window closes
|
||||
MainWindow::~MainWindow() {
|
||||
// Stop emulator thread when the main window closes
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
appRunning = false; // Set our running atomic to false in order to make the emulator thread stop, and join it
|
||||
|
||||
if (emuThread.joinable()) {
|
||||
emuThread.join();
|
||||
}
|
||||
|
||||
SDL_Quit();
|
||||
}
|
||||
|
||||
// Cleanup when the main window closes
|
||||
MainWindow::~MainWindow() {
|
||||
delete emu;
|
||||
delete menuBar;
|
||||
delete aboutWindow;
|
||||
|
|
Loading…
Add table
Reference in a new issue