Closed cydside closed 3 years ago
I'm getting the same error, hacky workaround for me was to ask for output path (use the dialog) before loading giu's GUI
I'm able to reproduce this behavior with a following code:
package main
import (
"github.com/AllenDang/giu"
"github.com/sqweek/dialog"
)
func loop() {
isOpen := true
giu.SingleWindow("Hello Warld").Pos(0, 0).IsOpen(&isOpen).Layout(giu.Layout{
giu.Label("Some label"),
giu.Button("click me").OnClick(func() {
_ = dialog.Message("clickMe clicked").YesNo()
}),
})
giu.Update()
}
func main() {
wnd := giu.NewMasterWindow("testwindow", 200, 200, 0, nil)
wnd.Run(loop)
}
and I'm able to fix it modifing main function in a following way:
func main() {
dialog.Message("some message").Error()
wnd := giu.NewMasterWindow("testwindow", 200, 200, 0, nil)
wnd.Run(loop)
}
so if we call dialog.Message on start, problem disappears.
Great! For the moment it fixes the program but hope for a package fix.
Thanks. Same symptoms in this issue as the gtk3 crash in #51. Unfortunately I still lack convenient access to a system which can reproduce (there's no windows X server which supports GLX otherwise I could run glfw in WSL).
Having the exact same issue on Ubuntu.
@NetForces @cydside Can you see if this patch resolves the problem? (Remember to revert any other workarounds you have in place)
diff --git a/dlgs_linux.go b/dlgs_linux.go
index ee37221..dd53506 100644
--- a/dlgs_linux.go
+++ b/dlgs_linux.go
@@ -1,6 +1,8 @@
package dialog
// #cgo pkg-config: gtk+-3.0
+// #cgo LDFLAGS: -lX11
+// #include <X11/Xlib.h>
// #include <gtk/gtk.h>
// #include <stdlib.h>
// static GtkWidget* msgdlg(GtkWindow *parent, GtkDialogFlags flags, GtkMessageType type,
@@ -13,6 +15,7 @@ import "C"
import "unsafe"
func init() {
+ C.XInitThreads()
C.gtk_init(nil, nil)
}
@sqweek I will try to test this out today. Thanks
@sqweek it works with the above modification (and that modification alone).
Can we expect a fix release soon ?
Thanks.
@NetForces fixed in 9a201b5. Thanks for testing!
Hi, I'm facing unexpected error including
github.com/sqweek/dialog
, clicking "Click Me" button, like in the following example:Reporting error: