if (x_dnd_targets)
xfree (x_dnd_targets);
- x_dnd_targets = targets;
+ block_input ();
+ x_dnd_targets = xmalloc (sizeof *targets * ntargets);
x_dnd_n_targets = ntargets;
+
+ memcpy (x_dnd_targets, targets,
+ sizeof *targets * ntargets);
+ unblock_input ();
+}
+
+static void
+x_free_dnd_targets (void)
+{
+ if (!x_dnd_targets)
+ return;
+
+ xfree (x_dnd_targets);
+ x_dnd_targets = NULL;
+ x_dnd_n_targets = 0;
}
static void
x_dnd_in_progress = false;
}
- x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
struct frame *any;
char *atom_name, *ask_actions;
Lisp_Object action, ltimestamp;
- specpdl_ref ref, count;
+ specpdl_ref ref, count, base;
ptrdiff_t i, end, fill;
XTextProperty prop;
xm_drop_start_message dmsg;
int n_events;
struct frame *event_frame;
+ base = SPECPDL_INDEX ();
+
/* Before starting drag-and-drop, walk through the keyboard buffer
to see if there are any UNSUPPORTED_DROP_EVENTs, and run them now
if they exist, to prevent race conditions from happening due to
if (popup_activated ())
error ("Trying to drag-and-drop from within a menu-entry");
+ record_unwind_protect_void (x_free_dnd_targets);
x_set_dnd_targets (target_atoms, ntargets);
ltimestamp = x_timestamp_for_selection (FRAME_DISPLAY_INFO (f),
x_dnd_frame = NULL;
}
- x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
x_dnd_frame = NULL;
}
- x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
#endif
}
- x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
#ifdef USE_GTK
XSETFRAME (action, x_dnd_return_frame_object);
x_dnd_return_frame_object = NULL;
- return action;
+
+ return unbind_to (base, action);
}
x_dnd_return_frame_object = NULL;
&& (any = x_any_window_to_frame (FRAME_DISPLAY_INFO (f),
x_dnd_end_window))
&& (allow_current_frame || any != f))
- return QXdndActionPrivate;
+ return unbind_to (base, QXdndActionPrivate);
if (x_dnd_action != None)
{
action = Qnil;
unblock_input ();
- return action;
+ return unbind_to (base, action);
}
- return Qnil;
+ return unbind_to (base, Qnil);
}
/* The focus may have changed. Figure out if it is a real focus change,
x_dnd_last_seen_window = None;
x_dnd_last_seen_toplevel = None;
x_dnd_frame = NULL;
- x_set_dnd_targets (NULL, 0);
}
}
x_dnd_last_seen_window = None;
x_dnd_last_seen_toplevel = None;
x_dnd_frame = NULL;
- x_set_dnd_targets (NULL, 0);
goto XI_OTHER;
}
x_dnd_last_seen_window = None;
x_dnd_last_seen_toplevel = None;
x_dnd_in_progress = false;
- x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)
x_dnd_last_seen_window = None;
x_dnd_last_seen_toplevel = None;
x_dnd_in_progress = false;
- x_set_dnd_targets (NULL, 0);
x_dnd_waiting_for_finish = false;
if (x_dnd_use_toplevels)