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

Calling Select on List before draw can crash #1960

Closed
andydotxyz opened this issue Feb 15, 2021 · 1 comment
Closed

Calling Select on List before draw can crash #1960

andydotxyz opened this issue Feb 15, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@andydotxyz
Copy link
Member

l := widget.NewList(...)
l.Select(0)

will crash

panic: runtime error: index out of range [-1] [recovered]
        panic: runtime error: index out of range [-1]

goroutine 9 [running]:
testing.tRunner.func1.1(0x43dcec0, 0xc000031160)
        /usr/local/Cellar/go/1.15.7/libexec/src/testing/testing.go:1072 +0x30d
testing.tRunner.func1(0xc0002c4780)
        /usr/local/Cellar/go/1.15.7/libexec/src/testing/testing.go:1075 +0x41a
panic(0x43dcec0, 0xc000031160)
        /usr/local/Cellar/go/1.15.7/libexec/src/runtime/panic.go:969 +0x1b9
fyne.io/fyne/v2/widget.(*listRenderer).scrollDown(0xc0001cc380, 0x42340000)
        /Users/andy/Go/src/fyne.io/fyne/v2/widget/list.go:291 +0x318
fyne.io/fyne/v2/widget.(*listRenderer).offsetChanged(0xc0001cc380)
        /Users/andy/Go/src/fyne.io/fyne/v2/widget/list.go:271 +0xbd
fyne.io/fyne/v2/widget.(*listRenderer).offsetUpdated(...)
        /Users/andy/Go/src/fyne.io/fyne/v2/widget/list.go:363
fyne.io/fyne/v2/widget.(*List).Select(0xc00031e140, 0x0)
        /Users/andy/Go/src/fyne.io/fyne/v2/widget/list.go:128 +0x1b8
...
@andydotxyz andydotxyz added the bug Something isn't working label Feb 15, 2021
andydotxyz added a commit to andydotxyz/fyne that referenced this issue Feb 15, 2021
…me render issues

I could not track down the issues directly, so imported Tree/Table style code to render with simpler code.

Fixes fyne-io#1948, fyne-io#1960
@andydotxyz andydotxyz changed the title Calling Select on List before draw will crash Calling Select on List before draw can crash Feb 15, 2021
@andydotxyz
Copy link
Member Author

On develop and prepping for 2.0.1 release as well

andydotxyz added a commit that referenced this issue Feb 25, 2021
…me render issues

I could not track down the issues directly, so imported Tree/Table style code to render with simpler code.

Fixes #1948, #1960

Conflicts:
	widget/list.go
	widget/list_test.go
	widget/testdata/list/offset_changed.xml
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

1 participant