From ff218e53235cfb8223aefe67ff18c9fb504ee718 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 6 Jun 2023 20:40:56 +1000 Subject: [PATCH] [v3 windows] Support systray.Destroy() --- v3/pkg/application/systemtray_windows.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/v3/pkg/application/systemtray_windows.go b/v3/pkg/application/systemtray_windows.go index 5e7703b54..827081ff9 100644 --- a/v3/pkg/application/systemtray_windows.go +++ b/v3/pkg/application/systemtray_windows.go @@ -247,4 +247,13 @@ func (s *windowsSystemTray) setIconPosition(position int) { } func (s *windowsSystemTray) destroy() { + // Remove and delete the system tray + getNativeApplication().unregisterSystemTray(s) + s.menu.Destroy() + w32.DestroyWindow(s.hwnd) + // Destroy the notification icon + nid := s.newNotifyIconData() + if !w32.ShellNotifyIcon(w32.NIM_DELETE, &nid) { + globalApplication.info(syscall.GetLastError().Error()) + } }