-
Notifications
You must be signed in to change notification settings - Fork 514
Description
Hi all,
I'm experiencing an issue where systray.AddMenuItem() intermittently stops working. I first noticed the problem in v1.0.0 and exists in all versions up to and including v1.0.4.
It occurs intermittently - if I run ~10 instances of the exe, ~2 tray icons will be missing a menu:
I noticed this only occurs when systray is run inside a go function (unfortunately a requirement for the App I'm working on).
The issue does not exist in v0.9.0. Would love to update to a newer version, but not really an option at this point in my project (and v0.9.0 is working fine for my immediate requirements).
Any thoughts / ideas /pointers on what might the problem be?
Testing Environment
- Windows 10 Pro x64 1903
- Go 1.14.1 windows/amd64
- TDM-GCC 9.2.0
main.go
This fork of v1.0.4 contains a modified example demonstrating the issue
package main
import (
"sync"
"github.com/getlantern/systray"
"github.com/getlantern/systray/example/icon"
)
func main() {
var wg sync.WaitGroup
wg.Add(1)
go runSystray(&wg)
wg.Wait()
}
func runSystray(wg *sync.WaitGroup) {
onReady := func() {
systray.SetIcon(icon.Data)
systray.SetTitle("Awsome App")
systray.SetTooltip("Lantern")
mQuitOrig := systray.AddMenuItem("Quit", "Quit App")
go func() {
<-mQuitOrig.ClickedCh
systray.Quit()
}()
}
onExit := func() {
wg.Done()
}
systray.Run(onReady, onExit)
}