Skip to content

Commit

Permalink
macOS: Fix crash on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Sep 19, 2024
1 parent fc02b1c commit 58af211
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/actionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,13 @@ void ActionManager::actionTriggered(QAction *triggeredAction, MainWindow *releva
auto key = triggeredAction->data().toStringList().first();

if (key == "quit") {
if (relevantWindow) // if a window was passed
relevantWindow->close(); // close it so geometry is saved
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Workaround to allow for a graceful exit (e.g. fire window close events)
// since QCoreApplication::quit can't accomplish this prior to Qt 6
qGuiApp->postEvent(qGuiApp, new QEvent(QEvent::Quit));
#else
QCoreApplication::quit();
#endif
} else if (key == "newwindow") {
qvApp->newWindow();
} else if (key == "open") {
Expand Down

0 comments on commit 58af211

Please sign in to comment.