Navigation Menu

Skip to content

Commit

Permalink
fix(tray): force item title string to be null-terminated (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Mar 9, 2022
1 parent 5ac5d4a commit 7f900a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-tray-item-title.md
@@ -0,0 +1,5 @@
---
"tao": patch
---

Fixes system tray item titles on Windows by forcing the string to be null-terminated.
4 changes: 4 additions & 0 deletions src/platform_impl/windows/menu.rs
Expand Up @@ -194,6 +194,10 @@ impl Menu {
anno_title.push('\t');
format_hotkey(accelerators, &mut anno_title);
}
// NOTE(amrbashir): The title must be a null-terminated string. Otherwise, it will display some gibberish characters at the end.
if !anno_title.ends_with("\0") {
anno_title.push_str("\0");
}

AppendMenuW(self.hmenu, flags, menu_id.0 as _, anno_title);

Expand Down

0 comments on commit 7f900a1

Please sign in to comment.