Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sequential writes to preferences does not save to file #2449

Closed
zivoy opened this issue Sep 8, 2021 · 2 comments
Closed

sequential writes to preferences does not save to file #2449

zivoy opened this issue Sep 8, 2021 · 2 comments
Labels
blocker Items that would block a forthcoming release bug Something isn't working

Comments

@zivoy
Copy link
Contributor

zivoy commented Sep 8, 2021

Describe the bug:

Setting a string value with the Preferences API more than once in a row causes it to not write the latter ones to the file. unless a gap is introduced.

To Reproduce:

Steps to reproduce the behaviour:
here is a sample program

a := app.NewWithID("TESTING")
fmt.Println("Before setting")
fmt.Println(a.Preferences().String("a"))
fmt.Println(a.Preferences().String("b"))
a.Preferences().SetString("a", "aaaaaaaaaaaaa")
//<-time.After(100*time.Millisecond)
a.Preferences().SetString("b", "bbbbbbbbbbbbb")
fmt.Println("After")
fmt.Println(a.Preferences().String("a"))
fmt.Println(a.Preferences().String("b"))

take this program and run it twice.
you will see that on the second run only a is set while b is still nothing.
now uncomment the line in the middle and run it twice more.
now both a and b are set.

Device (please complete the following information):

  • OS: Windows
  • Version: 10
  • Go version: 1.16.7
  • Fyne version: 2.0.4
@zivoy zivoy added the unverified A bug that has been reported but not verified label Sep 8, 2021
@zivoy zivoy changed the title sequential writes to prefrences does not save to file sequential writes to preferences does not save to file Sep 8, 2021
@andydotxyz andydotxyz added blocker Items that would block a forthcoming release bug Something isn't working and removed unverified A bug that has been reported but not verified labels Sep 8, 2021
@andydotxyz andydotxyz added this to the Aberlour (2.1) milestone Sep 8, 2021
andydotxyz added a commit to andydotxyz/fyne that referenced this issue Sep 8, 2021
@andydotxyz
Copy link
Member

Thanks for the report, this should be fixed in PR #2450, please do test and confirm :) @zivoy

@zivoy
Copy link
Contributor Author

zivoy commented Sep 9, 2021

It's fixed, works without the need for adding the delay now.

@zivoy zivoy closed this as completed Sep 9, 2021
andydotxyz added a commit that referenced this issue Sep 9, 2021
By syncing the File write we can be sure a second write puts the updated file after.

Fixes #2449
nullst added a commit to nullst/fyne that referenced this issue Sep 16, 2021
@nullst nullst mentioned this issue Sep 16, 2021
3 tasks
andydotxyz added a commit that referenced this issue Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Items that would block a forthcoming release bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants