From d0f6e791cae500e2565747565b9e8859d075cf40 Mon Sep 17 00:00:00 2001 From: askmeaboutloom Date: Sat, 5 Oct 2024 18:18:53 +0200 Subject: [PATCH] Always reparent start dialog windows on macOS Because not doing so crashes on Qt6. It's the inverse of Linux on Qt6, which crashes when reparenting instead, which is why this whole rigmarole was added. --- src/desktop/mainwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/desktop/mainwindow.cpp b/src/desktop/mainwindow.cpp index 3b155dcf85..ba3a7f56f7 100644 --- a/src/desktop/mainwindow.cpp +++ b/src/desktop/mainwindow.cpp @@ -1535,6 +1535,13 @@ void MainWindow::setStartDialogActions(dialogs::StartDialog *dlg) void MainWindow::closeStartDialog(dialogs::StartDialog *dlg, bool reparent) { + // Linux on Qt6 crashes when reparenting children of a dialog that's about + // to close after hosting, so we don't reparent in that case and just close + // the dialog. On the other hand, macOS on Qt6 crashes when closing the + // dialog instead, so we always reparent there. +#ifdef Q_OS_MACOS + reparent = true; +#endif if(reparent) { for(QDialog *child : dlg->findChildren( QString(), Qt::FindDirectChildrenOnly)) {