sqweek / dialog

Simple cross-platform dialog API for go-lang
ISC License
493 stars 76 forks source link

Nil parent for file dialogs #37

Closed amricko0b closed 3 years ago

amricko0b commented 4 years ago

Greetings!

gotk3 does not allow you to pass nill parent for file choosers. So, when I create a file dialog, my app crashes with NPE.

Am I do something wrong? If it's a bug, maybe it would be useful to populate FileBuilder with invisible window object that will be used as parent for file dialogs.

sqweek commented 4 years ago

Definitely a bug, the dialog package doesn't even offer an API to provide a parent for windows it spawns. This must have been an oversight in the gtk2 -> gtk3 upgrade (#4, #21) which I haven't tested personally because gotk3 wasn't building under WSL at the time. @meskio @anarcat do either of you have a better perspective here?

meskio commented 4 years ago

I don't know much about gtk, and I have to admit I didn't test the file chooser. Sorry.

I don't have any better ideas than the proposed invisible window. @amricko0b do you feel like giving it a try to do a pull req?

sqweek commented 4 years ago

@amricko0b If you could provide the stack trace for the panic it would be helpful to know where it crashes exactly.

akatsuki105 commented 4 years ago

I have the same bug in Ubuntu 18.04.

celer commented 4 years ago

I've submitted a PR to gotk3 here: https://github.com/gotk3/gotk3/issues/490

sqweek commented 4 years ago

@celer Thank you for looking into this! It has been on my list for way too long.

sqweek commented 3 years ago

Seems this has been addressed upstream, but maybe also related to #51. Should probably update go.mod with a known working version before closing this.

sqweek commented 3 years ago

Ultimately solved by removing gotk3 from the equation and using the gtk3 headers directly via cgo.