summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xterm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/xterm.c b/src/xterm.c
index f80b2ad2f02..c5b31553ae8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9435,6 +9435,13 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
#endif /* USE_X_TOOLKIT || USE_GTK */
+static void
+x_clear_dnd_targets (void)
+{
+ if (x_dnd_unwind_flag)
+ x_set_dnd_targets (NULL, 0);
+}
+
/* This function is defined far away from the rest of the XDND code so
it can utilize `x_any_window_to_frame'. */
@@ -9479,8 +9486,16 @@ x_dnd_begin_drag_and_drop (struct frame *f, Time time, Atom xaction,
}
if (CONSP (local_value))
- x_own_selection (QXdndSelection,
- Fnth (make_fixnum (1), local_value), frame);
+ {
+ ref = SPECPDL_INDEX ();
+
+ record_unwind_protect_void (x_clear_dnd_targets);
+ x_dnd_unwind_flag = true;
+ x_own_selection (QXdndSelection,
+ Fnth (make_fixnum (1), local_value), frame);
+ x_dnd_unwind_flag = false;
+ unbind_to (ref, Qnil);
+ }
else
{
x_set_dnd_targets (NULL, 0);