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 have searched the issue tracker for open issues that relate to the same problem, before opening a new one.
This issue only relates to a single bug. I will open new issues for any other problems.
Describe the bug
连续的调用 SetSystemTrayIcon 会出现程序占用内存不断增大
How to reproduce
go func() {
// TODO 存在内存泄露
t := true
for range time.NewTicker(time.Second).C {
if t {
desk.SetSystemTrayIcon(resourceAppIconPng)
} else {
desk.SetSystemTrayIcon(resource118104Png)
}
t = !t
}
}()
Screenshots
No response
Example code
package main
import (
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("SysTray")
m := &fyne.Menu{Label: "MyApp"}
show := "Show"
hide := "Hide"
action := func(menu *fyne.MenuItem, desk desktop.App) func() {
return func() {
if menu.Label == show {
w.Show()
menu.Label = hide
desk.SetSystemTrayIcon(resource118104Png)
} else {
w.Hide()
menu.Label = show
desk.SetSystemTrayIcon(resourceAppIconPng)
}
m.Refresh()
}
}
showOrClose := &fyne.MenuItem{Label: "Hide"}
if desk, ok := a.(desktop.App); ok {
showOrClose.Action = action(showOrClose, desk)
go func() {
// TODO 存在内存泄露
t := true
for range time.NewTicker(time.Second).C {
if t {
desk.SetSystemTrayIcon(resourceAppIconPng)
} else {
desk.SetSystemTrayIcon(resource118104Png)
}
t = !t
}
}()
m.Items = []*fyne.MenuItem{showOrClose}
desk.SetSystemTrayMenu(m)
desk.SetSystemTrayIcon(resourceAppIconPng)
}
w.SetContent(widget.NewLabel("Fyne System Tray"))
w.SetCloseIntercept(func() {
w.Close()
})
w.ShowAndRun()
}
Fyne version
v2.2.4
Go compiler version
1.19.1
Operating system
macOS
Operating system version
12.6
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Checklist
Describe the bug
连续的调用 SetSystemTrayIcon 会出现程序占用内存不断增大
How to reproduce
Screenshots
No response
Example code
Fyne version
v2.2.4
Go compiler version
1.19.1
Operating system
macOS
Operating system version
12.6
Additional Information
No response
The text was updated successfully, but these errors were encountered: