diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index d8a2edc1f..058a48a3f 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -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; diff --git a/OSBindings/Qt/mainwindow.h b/OSBindings/Qt/mainwindow.h index cef788a38..b08937188 100644 --- a/OSBindings/Qt/mainwindow.h +++ b/OSBindings/Qt/mainwindow.h @@ -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); };