Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(macos): crash on removing menu item #176

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/fix-macos-crash-on-remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"muda": patch
---

On macOS, fix a crash when removing a menu item.
6 changes: 2 additions & 4 deletions src/platform_impl/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,7 @@ impl MenuChild {
AddOp::Append => {
for menus in self.ns_menus.as_ref().unwrap().values() {
for ns_menu in menus {
let ns_menu_item: id =
item.make_ns_item_for_menu(self.ns_menu.as_ref().unwrap().0)?;
let ns_menu_item: id = item.make_ns_item_for_menu(ns_menu.0)?;
ns_menu.1.addItem_(ns_menu_item);
}
}
Expand All @@ -554,8 +553,7 @@ impl MenuChild {
AddOp::Insert(position) => {
for menus in self.ns_menus.as_ref().unwrap().values() {
for ns_menu in menus {
let ns_menu_item: id =
item.make_ns_item_for_menu(self.ns_menu.as_ref().unwrap().0)?;
let ns_menu_item: id = item.make_ns_item_for_menu(ns_menu.0)?;
let () = msg_send![ns_menu.1, insertItem: ns_menu_item atIndex: position as NSInteger];
}
}
Expand Down
Loading