fix(windows): run the about dialog in its own thread, closes #57 (#60)

This commit is contained in:
Amr Bashir 2023-03-27 21:08:43 +02:00 committed by GitHub
parent 059fceb130
commit f3883ee2d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"muda": "patch"
---
On Windows, fix panic when click a menu item while the `PredefinedMenuItem::about` dialog is open.

View file

@ -1154,7 +1154,14 @@ unsafe extern "system" fn menu_subclass_proc(
"About {}",
metadata.name.as_deref().unwrap_or_default()
));
MessageBoxW(hwnd, message.as_ptr(), title.as_ptr(), MB_ICONINFORMATION);
std::thread::spawn(move || {
MessageBoxW(
hwnd,
message.as_ptr(),
title.as_ptr(),
MB_ICONINFORMATION,
);
});
}
_ => {}