Fix sixtyfps::quit_event_loop() not exiting the event loop with Qt 6 on macOS

As per commit 0c02f133f3daee146b805149e69bba8cee6727b2 in qtbase (qt6),
quit() on QCoreApplication on macOS calls [NSApp terminate], which will
not return to main. The latter however is documented behavior, and
sixtyfps-viewer for example relies on it.
This commit is contained in:
Simon Hausmann 2021-10-11 16:53:02 +02:00
parent f0f264a94a
commit e305f0e61c

View file

@ -150,7 +150,11 @@ impl sixtyfps_corelib::backend::Backend for Backend {
{
use cpp::cpp;
cpp! {unsafe [] {
qApp->quit();
// Use a quit event to avoid qApp->quit() calling
// [NSApp terminate:nil] and us never returning from the
// event loop - sixtyfps-viewer relies on the ability to
// return from run().
QCoreApplication::postEvent(qApp, new QEvent(QEvent::Quit));
} }
};
}