From 45a427e68bead369c9da49d6424a331f684f3138 Mon Sep 17 00:00:00 2001 From: Larpon Date: Fri, 8 Apr 2022 12:32:38 +0200 Subject: [PATCH] clipboard: fix segfault when pasting to some X11 apps. Fixes #13891 (#13971) --- vlib/clipboard/x11/clipboard.c.v | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/vlib/clipboard/x11/clipboard.c.v b/vlib/clipboard/x11/clipboard.c.v index 85e022b595..ff96bdf67b 100644 --- a/vlib/clipboard/x11/clipboard.c.v +++ b/vlib/clipboard/x11/clipboard.c.v @@ -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,