diamondburned/gotk4

Copy text into clipboard works on Linux but crashes on Windows

fleshin opened this issue · 2 comments

Hi!

I am using v0.0.4 and below code to insert text into the system clipboard:

		display := gdk.DisplayGetDefault()
		clipboard := display.Clipboard()
		clipboard.SetText("some text")

On Linux it works as expected, but on windows it crashes with this error:

Exception 0xc0000005 0x0 0x252fd3f9a10 0x7ffb6a5c1d57
PC=0x7ffb6a5c1d57
signal arrived during external code execution

runtime.cgocall(0x7ff626d358b0, 0xc000619798)
        C:/msys64/mingw64/lib/go/src/runtime/cgocall.go:158 +0x4a fp=0xc000619770 sp=0xc000619738 pc=0x7ff626394cea
[github.com/diamondburned/gotk4/pkg/gdk/v4._Cfunc_gdk_clipboard_set_text(0x253ff6e1a20](http://github.com/diamondburned/gotk4/pkg/gdk/v4._Cfunc_gdk_clipboard_set_text(0x253ff6e1a20), 0x253b5758be0)
        _cgo_gotypes.go:1439 +0x52 fp=0xc000619798 sp=0xc000619770 pc=0x7ff6267496f2
[github.com/diamondburned/gotk4/pkg/gdk/v4.(*Clipboard).SetText.func2(0x253ff6e1a20](http://github.com/diamondburned/gotk4/pkg/gdk/v4.(*Clipboard).SetText.func2(0x253ff6e1a20), 0x33?)
       .../go/pkg/mod/[github.com/diamondburned/gotk4/pkg@v0.0.4/gdk/v4/gdkclipboard.go:621](http://github.com/diamondburned/gotk4/pkg@v0.0.4/gdk/v4/gdkclipboard.go:621) +0x50 fp=0xc0006197d0 sp=0xc000619798 pc=0x7ff626761230
[github.com/diamondburned/gotk4/pkg/gdk/v4.(*Clipboard).SetText(0xc000376500](http://github.com/diamondburned/gotk4/pkg/gdk/v4.(*Clipboard).SetText(0xc000376500), {0xc0000182c0, 0x33})
        .../go/pkg/mod/[github.com/diamondburned/gotk4/pkg@v0.0.4/gdk/v4/gdkclipboard.go:621](http://github.com/diamondburned/gotk4/pkg@v0.0.4/gdk/v4/gdkclipboard.go:621) +0x92 fp=0xc000619820 sp=0xc0006197d0 pc=0x7ff626761172

Is this expected to work on windows or I should use different API call?

Thanks for the amazing work!!!

I think it's expected to work. Have you tried running this in gdb? Preferably with a GTK4 build compiled with debugging symbols.

Upgrading the GTK4 build solved the issue and now works fine on windows as well.

Thanks for your help!!