Cocoa - ShowModal - Setting ModalResult does not close Form (until the user moves the mouse)
- Lazarus/FPC Version: Lazarus 2.3.0 (rev main-2_3-2069-g4aa7b5b3) FPC 3.2.2 x86_64-darwin-cocoa
- Operating System: MacOS 12.6.1 (seen in Big Sur, Monterey and Ventura)
- CPU / Bitness: Tested with 64 bit Intel, 64 bit Arm
- Widgetset: Cocoa
What happens
When opening a form with ShowModal, setting ModalResult in that called form will not close the form until the user moves the mouse.
What did you expect
Form should close immediately when setting ModalResult. (calling "close" behaves the same) Under Windows, and Linux (QT5/GTK2) this works as expected, however under Cocoa it does not.
Steps to reproduce
Create a new application (Form1). Add a new form (Form2). Add a button on Form1, which calls "Form2.ShowModal" when clicking the button. In Form2 start a timer, and when timer is done set ModalResult := mrOK (or mrCancel or whichever). Form2 will not close until the user moves the mouse.
Note: Calling Form2.close behaves the same way and does not close the form either (when the form was opened with ShowModal).
Example project: Example.zip