Added logic to force orderly close of Qt TAS editor any time a ROM is closed or the application is quit.

This commit is contained in:
mjbudd77 2021-12-30 21:38:23 -05:00
parent 8ee625c473
commit 5fc47dce6a
4 changed files with 29 additions and 0 deletions

View File

@ -2113,6 +2113,11 @@ void consoleWin_t::closeApp(void)
aviDiskThread->quit(); aviDiskThread->quit();
aviDiskThread->wait( 10000 ); aviDiskThread->wait( 10000 );
if ( tasWin != NULL )
{
tasWin->requestWindowClose();
}
FCEU_WRAPPER_LOCK(); FCEU_WRAPPER_LOCK();
fceuWrapperClose(); fceuWrapperClose();
FCEU_WRAPPER_UNLOCK(); FCEU_WRAPPER_UNLOCK();

View File

@ -297,6 +297,7 @@ void TasEditorWindow::closeEvent(QCloseEvent *event)
event->ignore(); event->ignore();
return; return;
} }
project.reset();
done(0); done(0);
deleteLater(); deleteLater();
@ -309,11 +310,26 @@ void TasEditorWindow::closeWindow(void)
{ {
return; return;
} }
project.reset();
printf("Tas Editor Close Window\n"); printf("Tas Editor Close Window\n");
done(0); done(0);
deleteLater(); deleteLater();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int TasEditorWindow::requestWindowClose(void)
{
askToSaveProject();
project.reset();
printf("Tas Editor Close Window\n");
done(0);
deleteLater();
return 0;
}
//----------------------------------------------------------------------------
QMenuBar *TasEditorWindow::buildMenuBar(void) QMenuBar *TasEditorWindow::buildMenuBar(void)
{ {
QMenu *fileMenu, *editMenu, *viewMenu, QMenu *fileMenu, *editMenu, *viewMenu,

View File

@ -411,6 +411,8 @@ class TasEditorWindow : public QDialog
bool handleInputColumnSetUsingPattern(int joy, int button); bool handleInputColumnSetUsingPattern(int joy, int button);
bool updateHistoryItems(void); bool updateHistoryItems(void);
int requestWindowClose(void);
QPoint getPreviewPopupCoordinates(void); QPoint getPreviewPopupCoordinates(void);
protected: protected:

View File

@ -44,6 +44,7 @@
#include "Qt/ConsoleDebugger.h" #include "Qt/ConsoleDebugger.h"
#include "Qt/ConsoleWindow.h" #include "Qt/ConsoleWindow.h"
#include "Qt/ConsoleUtilities.h" #include "Qt/ConsoleUtilities.h"
#include "Qt/TasEditor/TasEditorWindow.h"
#include "Qt/fceux_git_info.h" #include "Qt/fceux_git_info.h"
#include "common/cheat.h" #include "common/cheat.h"
@ -483,6 +484,11 @@ CloseGame(void)
saveInputSettingsToFile(); saveInputSettingsToFile();
} }
if ( tasWin != NULL )
{
tasWin->requestWindowClose();
}
FCEUI_CloseGame(); FCEUI_CloseGame();
DriverKill(); DriverKill();