From 4e59a5252c11738ce4849032a5aa2a23f97a18ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 6 Mar 2023 10:57:27 +0100 Subject: macOS: Use non-native app modal message box from nested event loops The NSAlert does not stay open when ran from a nested event loop, so we need to fall back to the cross platform dialog. The window modal dialog does not have this issue. Fixes: QTBUG-111524 Pick-to: 6.5 6.5.0 Change-Id: I63fba0a092018bb19edeef78c06587455d752235 Reviewed-by: Timur Pocheptsov --- src/plugins/platforms/cocoa/qcocoamessagedialog.mm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/cocoa') diff --git a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm index d5d9469832..8dcc5fab53 100644 --- a/src/plugins/platforms/cocoa/qcocoamessagedialog.mm +++ b/src/plugins/platforms/cocoa/qcocoamessagedialog.mm @@ -80,6 +80,11 @@ bool QCocoaMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality w if (!options()) return false; + if (windowModality == Qt::ApplicationModal && QThread::currentThread()->loopLevel() > 1) { + qCWarning(lcQpaDialogs, "Cannot use native application modal dialog from nested event loop"); + return false; + } + Q_ASSERT(!m_alert); m_alert = [NSAlert new]; m_alert.window.title = options()->windowTitle().toNSString(); -- cgit v1.2.3