Skip to content

Commit

Permalink
fix(core): Fix menu.remove trying to remove the menu itself instead o…
Browse files Browse the repository at this point in the history
…f the item

follow up to #9219
  • Loading branch information
FabianLars committed Mar 19, 2024
1 parent edc9923 commit ddcd5ac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/tauri/src/menu/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,15 +541,16 @@ fn remove<R: Runtime>(
item: (ResourceId, ItemKind),
) -> crate::Result<()> {
let resources_table = app.resources_table();
let (rid, kind) = item;
let (item_rid, item_kind) = item;
match kind {
ItemKind::Menu => {
let menu = resources_table.get::<Menu<R>>(rid)?;
do_menu_item!(resources_table, rid, kind, |i| menu.remove(&*i))?;
do_menu_item!(resources_table, item_rid, item_kind, |i| menu.remove(&*i))?;
}
ItemKind::Submenu => {
let submenu = resources_table.get::<Submenu<R>>(rid)?;
do_menu_item!(resources_table, rid, kind, |i| submenu.remove(&*i))?;
do_menu_item!(resources_table, item_rid, item_kind, |i| submenu
.remove(&*i))?;
}
_ => return Err(anyhow::anyhow!("unexpected menu item kind").into()),
};
Expand Down

0 comments on commit ddcd5ac

Please sign in to comment.