PolyMeilex / rfd

Rusty File Dialog
MIT License
600 stars 67 forks source link

In MacOS, MessageDialog fails to automatically collapse after the button "Ok" is clicked. #221

Open stuartZhang opened 6 days ago

stuartZhang commented 6 days ago

Hi genius,

I have written a demo which is able to reproduce the bug. Please download error-demo.zip and cargo run it in MacOS. My local MacOS version is image.

In a nutshell, even though the MessageDialog widget can't automatically collapse, the executing flow of the program isn't blocked. Namely, as soon as the button "Ok" on the MessageDialog widget is clicked,

  1. The method ".show()" instantly returns MessageDialogResult
  2. The subsequent MessageDialog with different title and message strings can be normally expanded and supersedes the old one as well.

However, the latest MessageDialog widget abnormally stays on the Desktop all the time, until the main process exits. The phenomenon merely occurs in MacOS. image

stuartZhang commented 3 days ago

Hi genius,

The failure of dismissing the dialog is a known fault of the widget NSAlert. According to the post, the another widget CFUserNotificationDisplayAlert is a good alternative underlying the MessageDialog use case. Good news! I have just found it in core-foundation-rs. The Objective-C API docs is here.

image

@PolyMeilex I'm not aware of how to invoke the function.