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

Conversation

pewsheen
Copy link
Contributor

@pewsheen pewsheen commented Mar 29, 2024

Before this patch, all NSMenuItem registered to the outer Submenu id, but it's actually added into the inner Submenu's NSMenu. When removing the menu item, lines here will call the outer Submenu's NSMenu to remove the menu item that is added in the inner Submenu's NSMenu hence exception is thrown:

if remove_from_cache {
if let Some(ns_menu_items) = child
.borrow_mut()
.ns_menu_items
.remove(&self.ns_menu.as_ref().unwrap().0)
{
for item in ns_menu_items {
let () =
unsafe { msg_send![self.ns_menu.as_ref().unwrap().1, removeItem: item] };
}
}
}

@amrbashir amrbashir merged commit 2edfbf1 into dev Apr 1, 2024
8 checks passed
@amrbashir amrbashir deleted the fix/macos-crash-on-remove-item branch April 1, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants