You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I upgraded from github.com/getlantern/systray v0.0.0-20190727060347-6f0e5a3c556c to github.com/getlantern/systray v1.1.0 and ran into the following panic on Windows 10 (not tested on other OS):
funconReadyFunc(c*util.Config) func() {
returnfunc() {
icon, err:=getIcon("assets/images/test.ico")
iferr!=nil {
logger.Info(fmt.Sprintf("Failed to load tray icon: %v", err))
} else {
systray.SetIcon(icon)
}
// additional setup here, never reached
}
}
//Helper to load a []byte to be used as a tray iconfuncgetIcon(sstring) ([]byte, error) {
b, err:=os.ReadFile(s)
iferr!=nil {
returnnil, err
}
returnb, nil
}
I fixed the panic by adding a time.Sleep(100 * time.Millisecond) before the call to systray.SetIcon(icon). It seems to work reliably with any slight delay before the call. I discovered it by using fmt.Printf() to print the icon bytes to the console which takes time. A call to len(icon) didn't provide enough of a delay. Is there some race condition here?
The text was updated successfully, but these errors were encountered:
@samschurter Is it possible for you to write up a quick snippet to trigger this? I'm looking at merging #206 but I don't really have any test cases to verify that this the PR works
Unfortunately I can't reproduce this anymore, at least not without significant time to work on it. The app has moved forward and I've added things that are slowing down the startup like user input dialogs and database connections. My PC was also upgraded in the meantime and I think it has a faster SSD, so maybe that's affecting it as well.
When I just create a basic example program that does nothing but load the tray icon, it has no issues. Without time to begin with the app as it's working and slowly strip things out until I get back to a place where it panics, I can't reproduce this bug.
Since I have no failing example at all anymore, I will close the issue.
I upgraded from
github.com/getlantern/systray v0.0.0-20190727060347-6f0e5a3c556c
github.com/getlantern/systray v1.1.0
and ran into the following panic on Windows 10 (not tested on other OS):The code I was using to setup the icon is here:
I fixed the panic by adding a
time.Sleep(100 * time.Millisecond)
before the call tosystray.SetIcon(icon)
. It seems to work reliably with any slight delay before the call. I discovered it by usingfmt.Printf()
to print the icon bytes to the console which takes time. A call tolen(icon)
didn't provide enough of a delay. Is there some race condition here?The text was updated successfully, but these errors were encountered: