From 4fc851a9c438eb4dd7a6797a15c6222832b85149 Mon Sep 17 00:00:00 2001 From: amrbashir Date: Mon, 23 Sep 2024 18:13:50 +0300 Subject: [PATCH] chore(deps): update `muda` to `0.15` --- .changes/muda-0-15.md | 5 +++++ Cargo.toml | 2 +- src/platform_impl/windows/mod.rs | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changes/muda-0-15.md diff --git a/.changes/muda-0-15.md b/.changes/muda-0-15.md new file mode 100644 index 0000000..824b8f5 --- /dev/null +++ b/.changes/muda-0-15.md @@ -0,0 +1,5 @@ +--- +"tray-icon": minor +--- + +Update `muda` crate to `0.15` diff --git a/Cargo.toml b/Cargo.toml index 99aa38e..6ad2025 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ serde = ["muda/serde", "dep:serde"] common-controls-v6 = ["muda/common-controls-v6"] [dependencies] -muda = { version = "0.14", default-features = false } +muda = { version = "0.15", default-features = false } crossbeam-channel = "0.5" once_cell = "1" thiserror = "1.0" diff --git a/src/platform_impl/windows/mod.rs b/src/platform_impl/windows/mod.rs index dbbb7b5..fed9a95 100644 --- a/src/platform_impl/windows/mod.rs +++ b/src/platform_impl/windows/mod.rs @@ -171,12 +171,12 @@ impl TrayIcon { } pub fn set_menu(&mut self, menu: Option>) { + // Safety: self.hwnd is valid as long as as the TrayIcon is if let Some(menu) = &self.menu { - menu.detach_menu_subclass_from_hwnd(self.hwnd as _); + unsafe { menu.detach_menu_subclass_from_hwnd(self.hwnd as _) }; } - if let Some(menu) = &menu { - menu.attach_menu_subclass_for_hwnd(self.hwnd as _); + unsafe { menu.attach_menu_subclass_for_hwnd(self.hwnd as _) }; } unsafe {