Skip to content

Commit 17f3430

Browse files
committed
qtui: Destroy main window before QApplication::quit
This works around a Qt 6 bug(?) that was causing the event dispatcher loop never to exit after a MainWindow::closeEvent().
1 parent efacaab commit 17f3430

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/qtui/qtui.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ class QtUI : public audqt::QtIfacePlugin
4646
audqt::init();
4747
aud_config_set_defaults("qtui", qtui_defaults);
4848
window = new MainWindow;
49+
QObject::connect(window, &QObject::destroyed, audqt::quit);
4950
return true;
5051
}
5152

@@ -60,6 +61,9 @@ class QtUI : public audqt::QtIfacePlugin
6061

6162
void show(bool show)
6263
{
64+
if (!window)
65+
return;
66+
6367
window->setVisible(show);
6468

6569
if (show)
@@ -72,7 +76,8 @@ class QtUI : public audqt::QtIfacePlugin
7276
void quit()
7377
{
7478
window->teardown();
75-
audqt::quit();
79+
window->deleteLater();
80+
window = nullptr;
7681
}
7782
};
7883

0 commit comments

Comments
 (0)