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

Struct binding fails to reload with slice field #2607

Open
drognisep opened this issue Nov 3, 2021 · 3 comments
Open

Struct binding fails to reload with slice field #2607

drognisep opened this issue Nov 3, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@drognisep
Copy link
Contributor

drognisep commented Nov 3, 2021

Describe the bug:

Whenever there is a slice of struct in a bound struct, the Reload method will always panic. I tried a few different permutations to see if it mattered whether the slice was of value or pointer, or if it was initialized or not, and all failed. However, reloading a bound struct with no slices in it works fine.

Based on the stack trace, the panic is originating here.
https://github.com/fyne-io/fyne/blob/master/data/binding/mapbinding.go#L292

To Reproduce:

Steps to reproduce the behaviour:

  1. Copy down and run the tests in this playground link
    https://play.golang.org/p/xvfx58--S66

Example code:

See playground link:
https://play.golang.org/p/xvfx58--S66

Device (please complete the following information):

  • OS: Windows 10
  • Version: 21H1 19043.1288
  • Go version: go version go1.16 windows/amd64
  • Fyne version: fyne.io/fyne/v2 v2.1.1
@drognisep drognisep added the unverified A bug that has been reported but not verified label Nov 3, 2021
@drognisep
Copy link
Contributor Author

@andydotxyz Looking at the surrounding code it looks like only singular, primitive types are supported for struct binding. Is this expected or just something that hasn't surfaced yet?

For example, I can try comparing the previous value with reflect.DeepEqual if f.Kind() == reflect.Slice, but the following switch statement doesn't copy the new value if it's changed because there's no case for reflect.Slice.

@andydotxyz
Copy link
Member

I have fixed the panic in the v2.1.2 bugfix release. Adding true support for slice content in struct mapping will require a bit more work, so keeping this open for the main work.
But panics should never occur :).

@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 Nov 25, 2021
@andydotxyz
Copy link
Member

Because the panic is fixed this will be de-prioritised a little.
Full slice support needs to be added but is not blocking 2.2

@andydotxyz andydotxyz removed the blocker Items that would block a forthcoming release label May 6, 2022
@andydotxyz andydotxyz removed this from the Bowmore Release (early 2022) milestone Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants