From ac13957b86ad699a76a0b248063551f971c4cef9 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Sat, 28 May 2022 09:37:29 +0800 Subject: Fix frame destruction issues and misuse of x_get_atom_name * src/frame.c (delete_frame): Prevent deleting the dnd frame while waiting for finish as well. * src/xselect.c (Fx_get_atom_name): Clean up code and fix uninitialized use of need_sync. * src/xterm.c (x_dnd_send_unsupported_drop, x_dnd_send_drop) (handle_one_xevent): Clean up usage of x_get_atom_name. (x_get_atom_name): Accept NULL for need_sync. * src/xterm.h: Update declarations. --- src/xselect.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/xselect.c') diff --git a/src/xselect.c b/src/xselect.c index 3f35842daa0..bfd081b1e28 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -2458,24 +2458,25 @@ If the value is 0 or the atom is not known, return the empty string. */) struct x_display_info *dpyinfo; Atom atom; bool had_errors_p, need_sync; + char *name; + Lisp_Object ret; dpyinfo = FRAME_DISPLAY_INFO (f); - CONS_TO_INTEGER (value, Atom, atom); - block_input (); x_catch_errors (dpy); - char *name = atom ? x_get_atom_name (dpyinfo, atom, &need_sync) : NULL; + name = x_get_atom_name (dpyinfo, atom, &need_sync); had_errors_p = need_sync && x_had_errors_p (dpy); x_uncatch_errors_after_check (); - Lisp_Object ret = empty_unibyte_string; + + ret = empty_unibyte_string; + if (name) { if (!had_errors_p) ret = build_string (name); xfree (name); } - unblock_input (); return ret; } -- cgit v1.2.1