1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-24 12:30:17 +00:00

Ensures 'Display' menu is removed if machine is closed.

This commit is contained in:
Thomas Harte 2020-06-26 23:27:14 -04:00
parent a0e534b309
commit 6925a04088
2 changed files with 6 additions and 1 deletions

View File

@ -62,7 +62,11 @@ void MainWindow::deleteMachine() {
audioThread.stop();
}
// Release the machine.
machine.reset();
// Remove any machine-specific options.
if(displayMenu) menuBar()->removeAction(displayMenu->menuAction());
}
MainWindow::~MainWindow() {
@ -393,7 +397,7 @@ void MainWindow::launchMachine() {
void MainWindow::addDisplayMenu(const std::string &compositeColour, const std::string &compositeMono, const std::string &svideo, const std::string &rgb) {
// Create a display menu.
QMenu *const displayMenu = menuBar()->addMenu(tr("&Display"));
displayMenu = menuBar()->addMenu(tr("&Display"));
QAction *compositeColourAction = nullptr;
QAction *compositeMonochromeAction = nullptr;

View File

@ -100,6 +100,7 @@ class MainWindow : public QMainWindow, public Outputs::Speaker::Speaker::Delegat
void deleteMachine();
QMenu *displayMenu = nullptr;
void addDisplayMenu(const std::string &compositeColour, const std::string &compositeMono, const std::string &svideo, const std::string &rgb);
};