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;
}
/* The frame where the drag-and-drop operation originated. */
struct frame *x_dnd_frame;
+/* That frame, but set when x_dnd_waiting_for_finish is true. Used to
+ prevent the frame from being deleted inside selection handlers and
+ other callbacks. */
+struct frame *x_dnd_finish_frame;
+
/* Flag that indicates if a drag-and-drop operation is no longer in
progress, but the nested event loop should continue to run, because
handle_one_xevent is waiting for the drop target to return some
important information. */
-static bool x_dnd_waiting_for_finish;
+bool x_dnd_waiting_for_finish;
/* The display the drop target that is supposed to send information is
on. */
}
name = x_get_atom_name (dpyinfo, x_dnd_wanted_action,
- false);
+ NULL);
if (name)
{
lval = Qnil;
atom_names = alloca (x_dnd_n_targets * sizeof *atom_names);
- name = x_get_atom_name (dpyinfo, x_dnd_wanted_action, false);
+ name = x_get_atom_name (dpyinfo, x_dnd_wanted_action, NULL);
if (!XGetAtomNames (dpyinfo->display, x_dnd_targets,
x_dnd_n_targets, atom_names))
{
x_dnd_end_window = x_dnd_last_seen_window;
x_dnd_in_progress = false;
+ x_dnd_finish_frame = x_dnd_frame;
if (x_dnd_last_seen_window != None
&& x_dnd_last_protocol_version != -1)
x_dnd_end_window = x_dnd_last_seen_window;
x_dnd_in_progress = false;
+ /* This doesn't have to be marked since it
+ is only accessed if
+ x_dnd_waiting_for_finish is true, which
+ is only possible inside the DND event
+ loop where that frame is on the
+ stack. */
+ x_dnd_finish_frame = x_dnd_frame;
+
if (x_dnd_last_seen_window != None
&& x_dnd_last_protocol_version != -1)
{
dpyinfo_pointer = (char *) dpyinfo;
value = NULL;
- *need_sync = false;
+
+ if (need_sync)
+ *need_sync = false;
+
buffer = alloca (45 + INT_STRLEN_BOUND (int));
switch (atom)
}
name = XGetAtomName (dpyinfo->display, atom);
- *need_sync = true;
+
+ if (need_sync)
+ *need_sync = true;
if (name)
{