[Bug]: macOS Tahoe, runModalLoop() doesn't process system events in time
Detailed steps on how to reproduce the bug
I have a standalone application with a dialog window which runs with a runModalLoop(). There is a button which calls exitModalState(). On macOS Tahoe a button event doesn't file in time, it fires later after a mouse move event. Escape button fires with delay as well. There was no issue before the Tahoe on same code.
Please see the small RunModalEvents project attached.
https://github.com/user-attachments/assets/5726298d-faa5-47d9-8771-9b116d8559f2
What is the expected behaviour?
The issue is related to the [NSApp nextEventMatchingMask] call. It starts working correctly if I use untilDate argument set to [NSDate now], [NSDate distantPast] or even nil. [NSDate distantFuture] makes the same issue as a current [NSDate dateWithTimeIntervalSinceNow: 0.001]
Operating systems
macOS
What versions of the operating systems?
macOS 26 Tahoe
Architectures
Arm64/aarch64
Stacktrace
Plug-in formats (if applicable)
No response
Plug-in host applications (DAWs) (if applicable)
No response
Testing on the develop branch
The bug is present on the develop branch
Code of Conduct
- [x] I agree to follow the Code of Conduct
Using modal loops has been deprecated for some time.
We noticed it two iOS versions ago, that Apple quietly started breaking programs with modal loops, even though according to their documentation some uses of it should still work.
We filed a bug report, and made a good case pointing to their own documentation, but we only received a blanket rejection telling us not to use modal loops. In light of this it's not likely that we can keep modal loop behaviour working well, when the underlying OS doesn't support this.
I recommend that you use the async functions instead, as I can't promise when or if at all this ticket will be addressed.