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

Copy text into clipboard works on Linux but crashes on Windows #90

Closed
fleshin opened this issue Jan 3, 2023 · 2 comments
Closed

Copy text into clipboard works on Linux but crashes on Windows #90

fleshin opened this issue Jan 3, 2023 · 2 comments

Comments

@fleshin
Copy link

fleshin commented Jan 3, 2023

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!!!

@diamondburned
Copy link
Owner

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

@fleshin
Copy link
Author

fleshin commented Jan 4, 2023

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

Thanks for your help!!

@fleshin fleshin closed this as completed Jan 4, 2023
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

2 participants