1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

clipboard: fix segfault when pasting to some X11 apps. Fixes #13891 (#13971)

This commit is contained in:
Larpon 2022-04-08 12:32:38 +02:00 committed by GitHub
parent 52f1c615a6
commit 45a427e68b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -330,7 +330,7 @@ fn (mut cb Clipboard) start_listener() {
property: xsre.property
}
if !cb.transmit_selection(&xse) {
xse.property = new_atom(0)
xse.property = Atom(0)
}
C.XSendEvent(cb.display, xse.requestor, 0, C.PropertyChangeMask, voidptr(&xse))
C.XFlush(cb.display)
@ -479,10 +479,6 @@ fn (cb &Clipboard) get_supported_targets() []Atom {
return cb.get_atoms(AtomType.utf8_string, .xa_string, .text, .text_plain, .text_html)
}
fn new_atom(value int) &Atom {
return unsafe { &Atom(&u64(u64(value))) }
}
fn create_xwindow(display &C.Display) Window {
n := C.DefaultScreen(display)
return C.XCreateSimpleWindow(display, C.RootWindow(display, n), 0, 0, 1, 1, 0, C.BlackPixel(display,