Closed
Description
Checklist
- 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
When using fyne.App.Run()
to start an application, only first written preference is saved in Preferences store.
How to reproduce
- Launch example code.
- Take a look at
${XDG_CONFIG_HOME}/fyne/some.test/preferences.json
- Be surprised that only width is saved.
Screenshots
No response
Example code
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
)
var (
a fyne.App
wnd fyne.Window
)
func main() {
a = app.NewWithID("some.test")
wnd = a.NewWindow("Test")
wnd.Resize(fyne.Size{
Width: float32(a.Preferences().IntWithFallback("mainwindow/width", 800)),
Height: float32(a.Preferences().IntWithFallback("mainwindow/height", 600)),
})
wnd.SetCloseIntercept(closeIntercept)
wnd.Show()
a.Run()
}
func closeIntercept() {
windowSizes := wnd.Canvas().Size()
a.Preferences().SetInt("mainwindow/width", int(windowSizes.Width))
a.Preferences().SetInt("mainwindow/height", int(windowSizes.Height))
wnd.Close()
}
Fyne version
2.2.3 and today's develop at b71c0f2
Go compiler version
1.18.4
Operating system
macOS
Operating system version
macOS 12.5
Additional Information
This problem does not appear when using fyne.Window.ShowAndRun
.
Activity