Update dropdown.go to compile to lib.so

Fixing a bug for compiling into a library

2024.06.17 10:13:00 go(build)(error): # /tmp/go-build4195759871/b113/librtl-tview.so
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51de66]

goroutine 1 [running]:
cmd/link/internal/loader.(*Loader).SymSize(0x1?, 0x0?)
        cmd/link/internal/loader/loader.go:815 +0x46
cmd/link/internal/ld.(*pclntab).generatePctab.func1(0x0)
        cmd/link/internal/ld/pcln.go:467 +0x56
cmd/link/internal/ld.(*pclntab).generatePctab(0xc000c46f40, 0xc000124200, {0xc001724000, 0x4f3, 0x1?})
        cmd/link/internal/ld/pcln.go:490 +0x39f
cmd/link/internal/ld.(*Link).pclntab(0xc000124200, {0xc001720000?, 0xc0000126e0?, 0xf?})
        cmd/link/internal/ld/pcln.go:804 +0x1ad
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0xc000012549, 0x1, 0x1}, ...})
        cmd/link/internal/ld/main.go:412 +0x175c
main.main()
        cmd/link/main.go:72 +0xdfb
This commit is contained in:
Makarov Dreyar 2024-06-17 10:18:17 +03:00 committed by GitHub
parent 23476fa0ba
commit 1a723d123a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -275,10 +275,8 @@ func (d *DropDown) AddOption(text string, selected func()) *DropDown {
func (d *DropDown) SetOptions(texts []string, selected func(text string, index int)) *DropDown { func (d *DropDown) SetOptions(texts []string, selected func(text string, index int)) *DropDown {
d.list.Clear() d.list.Clear()
d.options = nil d.options = nil
for index, text := range texts { for _, text := range texts {
func(t string, i int) { d.AddOption(text, nil)
d.AddOption(text, nil)
}(text, index)
} }
d.selected = selected d.selected = selected
return d return d