Skip to content

Commit

Permalink
fix(macos): close menu when dropping NsMenuRef, close #129, #173 (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
pewsheen authored May 27, 2024
1 parent 32a7e0a commit 20ea54b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/mac-close-menu-before-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"muda": patch
---

On macOS, close tray menu before removing it to prevent user click on a released menu item resulting in a crash.
1 change: 1 addition & 0 deletions src/platform_impl/macos/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct NsMenuRef(u32, id);
impl Drop for NsMenuRef {
fn drop(&mut self) {
unsafe {
let _: () = msg_send![self.1, cancelTrackingWithoutAnimation];
let _: () = msg_send![self.1, release];
}
}
Expand Down

0 comments on commit 20ea54b

Please sign in to comment.