-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
unverifiedA bug that has been reported but not verifiedA bug that has been reported but not verified
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 trying to remove an item from a bound list the operation succeeds, but also produces a Fyne error: index out of bounds. This happens for every member item of the list.
2026/02/18 16:56:27 Fyne error: Error getting current data value
2026/02/18 16:56:27 Cause: index out of bounds
2026/02/18 16:56:27 At: /home/erik/go/pkg/mod/fyne.io/fyne/v2@v2.7.2/widget/label.go:184
How to reproduce
I used a variation of the example from the Fyne docs under "Data Binding/List". But instead of adding items, I am deleting the selected item.
See code for details.
Screenshots
No response
Example code
package main
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("List Data")
data := binding.BindStringList(
&[]string{"Item 1", "Item 2", "Item 3"},
)
var selectedID int
list := widget.NewListWithData(
data,
func() fyne.CanvasObject {
return widget.NewLabel("template")
},
func(di binding.DataItem, co fyne.CanvasObject) {
co.(*widget.Label).Bind(di.(binding.String))
},
)
list.OnSelected = func(id widget.ListItemID) {
selectedID = id
}
remove := widget.NewButton("Remove", func() {
v, err := data.GetValue(selectedID)
if err != nil {
panic(err)
}
err = data.Remove(v)
if err != nil {
panic(err)
}
})
w.SetContent(container.NewBorder(nil, remove, nil, nil, list))
w.Resize(fyne.NewSize(300, 500))
w.ShowAndRun()
}Fyne version
2.7.2
Go compiler version
1.25.5
Operating system and version
Ubuntu 22.04 LTS
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
unverifiedA bug that has been reported but not verifiedA bug that has been reported but not verified