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

Open file dialog crashes #525

Closed
doamatto opened this issue Mar 8, 2021 · 1 comment
Closed

Open file dialog crashes #525

doamatto opened this issue Mar 8, 2021 · 1 comment

Comments

@doamatto
Copy link

doamatto commented Mar 8, 2021

When I try to use the ui.OpenFile() function, the application crashes with the following error in the console (scroll down to «Console log»)

Code:

pickFile := ui.NewButton("Pick video file")
box := ui.NewVerticalBox()
box.Append(pickFile, false)
window := ui.NewWindow("Demo", 300, 200, false)
window.SetMargined(true)
window.SetChild(box)
[...]
pickFile.OnClicked(func(*ui.Button) {
  filename := ui.OpenFile(mainwin)
  if filename == "" {
    filename = "(cancelled)"
  }
  file.SetText(filename)
})

Console log:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x51ed72]

goroutine 1 [running, locked to thread]:
github.com/andlabs/ui.OpenFile.func1(0x0, 0xc000176f90)
        /home/doamatto/go/pkg/mod/github.com/andlabs/[email protected]/stddialogs.go:18 +0x22
github.com/andlabs/ui.OpenFile(0x0, 0x0, 0x0)
        /home/doamatto/go/pkg/mod/github.com/andlabs/[email protected]/stddialogs.go:18 +0x44
main.main.func1.2(0xc000176d80)
        /home/doamatto/[...]/main.go:100 +0x36
github.com/andlabs/ui.pkguiDoButtonOnClicked(0x2703010, 0x0)
        /home/doamatto/go/pkg/mod/github.com/andlabs/[email protected]/button.go:60 +0x7b
github.com/andlabs/ui._cgoexpwrap_e99bb8362bf9_pkguiDoButtonOnClicked(0x2703010, 0x0)
        _cgo_gotypes.go:3863 +0x35
github.com/andlabs/ui._Cfunc_uiMain()
        _cgo_gotypes.go:2519 +0x41
github.com/andlabs/ui.Main(0xaeb3e8, 0x0, 0xc0000340b8)
        /home/doamatto/go/pkg/mod/github.com/andlabs/[email protected]/main.go:41 +0xff
main.main()
        /home/doamatto/[...]/main.go:13 +0x2d

Hardware info: Linux hackermans-mac-pro 5.8.0-7642-generic #47~1614007149~20.10~82fb226-Ubuntu SMP Tue Feb 23 02:59:01 UTC x86_64 x86_64 x86_64 GNU/Linux

Go version 1.14.7 linux/amd64

@doamatto
Copy link
Author

Moved to andlabs/ui#412

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant