mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
fix(core): Fix menu.remove trying to remove the item from itself instead of from the menu (#9225)
follow up to https://github.com/tauri-apps/tauri/pull/9219/
This commit is contained in:
@@ -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()),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user