567 // interrupted. This is mostly an optimization, but it also allow us |
567 // interrupted. This is mostly an optimization, but it also allow us |
568 // to use [NSApp run], which is the recommended way of running applications |
568 // to use [NSApp run], which is the recommended way of running applications |
569 // in cocoa. [NSApp run] should be called at least once for any cocoa app. |
569 // in cocoa. [NSApp run] should be called at least once for any cocoa app. |
570 if (NSModalSession session = d->currentModalSession()) { |
570 if (NSModalSession session = d->currentModalSession()) { |
571 QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); |
571 QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); |
572 while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse) |
572 while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt) |
573 qt_mac_waitForMoreModalSessionEvents(); |
573 qt_mac_waitForMoreModalSessionEvents(); |
574 if (!d->interrupt && session == d->currentModalSessionCached) { |
574 if (!d->interrupt && session == d->currentModalSessionCached) { |
575 // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event |
575 // INVARIANT: Someone called e.g. [NSApp stopModal:] from outside the event |
576 // dispatcher (e.g to stop a native dialog). But that call wrongly stopped |
576 // dispatcher (e.g to stop a native dialog). But that call wrongly stopped |
577 // 'session' as well. As a result, we need to restart all internal sessions: |
577 // 'session' as well. As a result, we need to restart all internal sessions: |